Creating a for loop using datasets of different sizes

4 views (last 30 days)
I am creating several plots to verify data. I want to plot 4 separate datasets each with 11 figures. Is there a way to use the datasets in a for loop so that this process is automated? I have read to use something along the lines of this...
for i=1:10
A{i} = 1:i;
end
But I am confused on how to go about properly indexing my data. Here is a piece of my code:
x = rod1; % Put in the rod of interest here
for n = 1:4
% Axial Load
figure(1)
plot(x(:,1), x(:,22:23))
ylim([0 800])
grid on
title(['Rod ',num2str(n), ' Axial Load'])
xlabel('Serial Date')
ylabel('Rod Load [kips]')
% Average Displacement
figure(2)
plot((x(:,1)),(x(:,32)))
ylim([-1.5 1.5])
grid on
title(['Rod ',num2str(n),' Displacement'])
xlabel('Serial Date')
ylabel('Average Displacement [in]')
% Temperatures
figure(3)
plot((x(:,1)),(x(:,[16,17,20,21])))
ylim([40 90])
grid on
title(['Rod ',num2str(n),' Temperatures'])
xlabel('Serial Date')
ylabel('Temperatures [degrees F]')
.
.
.
end
What I would like is to create a for loop so that x cycles through rod1, rod2, rod3, and rod4. (These matrices are all of different sizes. They were cut from a large matrix of raw data.) At the end of this I would like to have a total of 44 plots for comparison.
Thank you for the help

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!