I have finally been able to get an Excel sheet read in and get the data plotted as needed and to get the data averaged. However, now I am having issues trying to find the local min and local max between values on the graph. I am trying to find the local min between say 20 and 50 and the local max between 50 and 100. Here is the code that I am using while bringing in the data:
filename = ('10070.xlsx'); %Opens the specified file
[data, text, ~] = xlsread(filename); %Gives a table for data and text
[~,l] = find(strcmp(text, 'Left Knee Angle'));
left_data = data(:,l);
subplot(2,2,1);
plot(left_data)
title({'Left Knee Angle'});
ylabel({'Angle'});
xlabel({'% of Trial'});
[~,r] = find(strcmp(text, 'Right Knee Angle'));
right_data = data(:,r);
subplot(2,2,2);
plot(right_data)
title({'Right Knee Angle'});
ylabel({'Angle'});
xlabel({'% of Trial'});
left_avg = mean(left_data,2);
subplot(2,2,3);
plot(left_avg)
title({'Left Knee Average Angle'});
ylabel({'Angle'});
xlabel({'% of Trial'});
right_avg = mean(right_data,2);
subplot(2,2,4);
plot(right_avg)
title({'Right Knee Average Angle'});
ylabel({'Angle'});
xlabel({'% of Trial'});
I have tried using:
[maxVal, maxIndex] = max(l(x>=20&x<=50));
But this has not worked for me. Anyone have any ideas/better ways to do this? Maybe I'm just typing something in incorrectly? I will also repeat the process for the other set of data (it is broken into left and right). Also, out of curiosity, is there a way to pull each one of the graphs in individually and find the local min/max from the individual graphs from left and right that are pulled in and average those? I'm just trying to think ahead on this. Here is a link to a screenshot of the graphs: https://i.stack.imgur.com/QO78M.jpg