How to plot a specific variable if condition is met

4 views (last 30 days)
Hi,
I have code that is comparing two sensors (Ms and V). V measures both left and right, however Ms measures only the side that it is placed on. I would like to only plot the correct side of V so that it corresponds to Ms, instead of plotting both left and right of V.
I have previously read in whether the file I am workign with is the left or the right side, in order to use cross correlation to time synchronise the different sensor files, please see below.
if strcmp(sensorside{1,1},cellstr('left'))
disp('left!');
[r,lags] = xcorr(angles{1,i}.LKneeAngles(:,1),MS_knee_angle2,numrows_Vic(i)); %tried alignsignals instead of xcorr
elseif strcmp(sensorside{1,1},cellstr('right'))
disp('right!');
[r,lags] = xcorr(angles{1,i}.RKneeAngles(:,1),MS_knee_angle2,numrows_Vic(i));
else
error('Help!');
end
How would I go about plotting only the left or only the right side for the V sensor depending on what side the sensor is placed? I am not sure how to do the if loop for a figure.
%% Time synch plot for MS and Vicon _changed 19/08/2022
figure
plot(time', sync(i).V_LK);
hold on
plot(time',sync(i).V_RK);
hold on
plot(time',sync(i).MS_K);
title('Time synchronised plots comparing MS to Vicon for activity',activity);
legend('Vicon left knee', 'Vicon right knee','MotionSense');
Thank you so much for any advice

Answers (0)

Categories

Find more on Surfaces, Volumes, and Polygons in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by