Loading multiple mat files and plot them right
Show older comments
I want to plot 3 different .mat files. My Structure looks something like this.
d = dir('*.mat');
Anzmat = length(d);
for j = 1:3 %just use the first 3 Files in the Order structure ->test 1, test 2, test 3
load(d(j).name)
%%%%%%%Calculations%%%%%%%
figure();
plot(t_LP, x_ac)
title('acceleration shorten file x-axis')
xlabel('time (s)')
ylabel('a (m/s^2)')
%%%%%%%Calculations%%%%%%%
figure();
plot(t_LP, y_ac)
title('acceleration shorten file y-axis')
xlabel('time (s)')
ylabel('a (m/s^2)')
%%%%%%%Calculations%%%%%%%
figure();
plot(t_LP, velocity_x)
title('velocity shorten file x-axis')
xlabel('time (s)')
ylabel('v (m/s)')
%%%%%%%Calculations%%%%%%%
figure();
plot(t_LP, velocity_y)
title('velocity shorten file y-axis')
xlabel('time (s)')
ylabel('v (m/s)')
%%%%%%%Calculations%%%%%%%
plot(t_LP,ac,'r')
title('final velocity')
xlabel('time (s)')
ylabel('v (m/s)')
end
Now my aim is to plot the Files: test 1, test 2, test 3 together in one diagramm. So in the end i should have 5 plots and in each are 3 diagramms from the test1,test2,test3 mat data. So i can clearly analyse how different the measurements are in one plot.
2 Comments
Daniel Basow
on 18 Jul 2021
Edited: Daniel Basow
on 18 Jul 2021
Mathieu NOE
on 19 Jul 2021
hmm
there are a few answers / posts about why one should avoid dynamic variable names (and therefore not use assignin)
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!