I have created a loop in MATLAB to automate some FFT work. The loop selects a new .mat files each time through. I have extracted a cell array which references the test data being processed (for example Test 1), and I would like to use that information in the title of the figures I produce.
I have tried
title(fileInfo);
Here, fileInfo
contains Test 1.
What do I need to do to be able to get this information into the figure on each iteration of the loop?
I am not sure, how you are calling your matfiles, but this is the good method to achieve the task:
matfiles = dir('*.mat') ;
for i = 1:length(matfiles)
%% do waht you want
figure
title(matfiles(i).name)
end
Straight away to your question. You can get title like below:
fileInfo = 'Test 1';
figure
%% plot
title(fileInfo)
Or straight away:
figure
% plot
title('Test 1')