MATLAB: Figure title in a loop

for loop

I am producing a subplot inside a for loop with the following:
for i=1:length(fieldnames(Data));
subplot(length(fieldnames(Data)),1,i);
plot(Data.(Name{i}));
end
Next I want one title which lists the fieldnames, something like:
title('Temperature a)fieldname1 b)fieldname2 c)fieldname3')
However, I don't know how to make the fieldname for 'Data' to appear in the title command.

Best Answer

names = fieldnames(Data);
for i = 1 : length(names);
subplot(length(names),1,i);
%plot(Data.(Name{i}));
title(names{i});
end
Related Question