Plotting Two .mat Files

16 views (last 30 days)
SYAFIQ FALIQ ALFAN
SYAFIQ FALIQ ALFAN on 23 Dec 2018
Commented: Etsuo Maeda on 26 Dec 2018
Hi All,
I am trying to plot two .mat files using a function that was previously made. The function is used to plot only one set of .mat files data. Thus, in each figures it represents only one set of data. My intention is to use two sets of data and plot it in the same figures, if possible figure (1) and figure (2). So the data that will be plot would be the 'NouMovement0001.mat' and the other one is 'NouMovement0002.mat'. In the 3D plot, I should be able to distinguish between these datas by color coding it like for example in the figure (2) right?
Please let me know as I am trying to figure out how to actually plot these two sets of .mat files datas. Do I have to redefine to combine both datas or is there another way to plot this.
fileName = 'NouMovement0001';
curDir = pwd;
Data = load_qualisys_mat(curDir, fileName);
Markers = Data.Markers ;
figure(1)
iFrame = 1000 ;
Fields = fieldnames(Markers) ;
draw_stick_picture(Markers,Fields,iFrame,'xyz', 'ko')
axis equal
grid on
figure(2)
plot(Markers.RAnkle(:,3), 'b') ; hold on
plot(Markers.LAnkle(:,3), 'r') ;
As you can see, there are two figures, I am grateful if any of you able to guide me at least one of them. The first figure is a 3D graph and the load_qualisys_mat is the function that was made prior to this.
Thanks.
  7 Comments
SYAFIQ FALIQ ALFAN
SYAFIQ FALIQ ALFAN on 23 Dec 2018
Noted. I have uploaded the files! Thanks for mentioning it.

Sign in to comment.

Accepted Answer

Etsuo Maeda
Etsuo Maeda on 26 Dec 2018
Hi Syafiq Faliq Alfan,
Christmas season has come. I am also blind as Guillaume and Madhan Ravi mentioned. But the following code should be okay for you.
clear; close all;
fileName1 = 'NouMovement0001';
curDir1 = pwd;
Data1 = load_qualisys_mat(curDir1, fileName1);
Markers1 = Data1.Markers ;
fileName2 = 'NouMovement0002';
curDir2 = pwd;
Data2 = load_qualisys_mat(curDir2, fileName2);
Markers2 = Data2.Markers ;
subplot(1, 2, 1)
grid on
hold on
iFrame1 = 1000 ;
Fields1 = fieldnames(Markers1) ;
draw_stick_picture(Markers1,Fields1,iFrame1,'xyz', 'o')
iFrame2 = 1000 ;
Fields2 = fieldnames(Markers2) ;
draw_stick_picture(Markers2,Fields2,iFrame2,'xyz', 'o')
legend('NouMovement0001', 'NouMovement0002', 'Location', 'northeast');
view(3)
hold off
subplot(2, 2, 2)
hold on
plot(Markers1.RAnkle(:,3), 'b') ;
plot(Markers1.LAnkle(:,3), 'r') ;
legend('NouMovement0001_1', 'NouMovement0001_2')
ylim([0 200])
hold off
subplot(2, 2, 4)
hold on
plot(Markers2.RAnkle(:,3), 'b') ;
plot(Markers2.LAnkle(:,3), 'r') ;
legend('NouMovement0002_1', 'NouMovement0002_2')
ylim([0 200])
hold off
HTH
  2 Comments
Etsuo Maeda
Etsuo Maeda on 26 Dec 2018
Hi Syafiq,
Wishing you all the best with the project. And I hope you have a nice days with your loved ones.
Etsuo

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by