How do I create a table as a subplot?

45 visualizaciones (últimos 30 días)
Samuel Halle
Samuel Halle el 1 de Nov. de 2017
Respondida: Walter Roberson el 2 de Nov. de 2017

Hello all,

So I have a long script of code that gives me many variables from a research experiment I conducted. I am now trying to display all the information in a single figure to make it easy to understand. In the figure I want to have several graphs and then a table giving the average values from those graphs in the bottom quadrant. Here is an image of what I want it to look like: <<

>>

This is made more difficult because I want the graphs and table I have to display the average information from a series of 3 different data files. To accomplish this, I created a loop to average everything together which is as follows:

trial_loop = 1;
while trial_loop <= 3
    WBB_Combined_MM
      figure(999)
      subplot(5,2,1)
      hold on
      plot(R_hipangle)
      subplot(5,2,3)
      hold on
      plot(R_kneeangle)
      subplot(5,2,5)
      hold on
      plot(R_ankangle)
      subplot(5,2,7)
      hold on
      plot(Fz_total_filt)
      subplot(5,2,9)
      hold on
      plot(Fx_total_filt)
      subplot(5,2,2)
      hold on
      plot(L4_Ydata)
      subplot(5,2,4)
      hold on
      plot(L4_Velocity_Y_FULL)
%     subplot(5,2,6)
%     hold on
%     plot(Table)
      trial_loop = trial_loop+1;
end

My trouble is with the final subplot (5,2,6) which will not display my table. Even if it did I don't think it would average the values from the 3 separate files together. Please help me figure out how to do this.

Thanks for your Help!

p.s

To make this a thorough question here is the code that is being run through the loop. I think it is irrelevant to this question so you do not need to read through it unless you want.

      Open_C3D_Basketball;
      interp_codamotion_basketball;
      filtdata = processeddata;
      R_Toe_Xdata=filtdata(:,strmatch('R_Toe_X', labels));
      R_Toe_Ydata=filtdata(:,strmatch('R_Toe_Y', labels));
      R_Toe_Zdata=filtdata(:,strmatch('R_Toe_z', labels));
      R_Heel_Xdata=filtdata(:,strmatch('R_Heel_X', labels));
      R_Heel_Ydata=filtdata(:,strmatch('R_Heel_Y', labels));
      R_Heel_Zdata=filtdata(:,strmatch('R_Heel_Z', labels));
      R_Ank_Xdata=filtdata(:,strmatch('R_Ank_X', labels));
      R_Ank_Ydata=filtdata(:,strmatch('R_Ank_Y', labels));
      R_Ank_Zdata=filtdata(:,strmatch('R_Ank_Z', labels));
      R_5th_Xdata=filtdata(:,strmatch('R_5th_X', labels));
      R_5th_Ydata=filtdata(:,strmatch('R_5th_Y', labels));
      R_5th_Zdata=filtdata(:,strmatch('R_5th_Z', labels));
      R_Shin_Xdata=filtdata(:,strmatch('R_Shin_X', labels));
      R_Shin_Ydata=filtdata(:,strmatch('R_Shin_Y', labels));
      R_Shin_Zdata=filtdata(:,strmatch('R_Shin_Z', labels));
      R_Knee_Xdata=filtdata(:,strmatch('R_Knee_X', labels));
      R_Knee_Ydata=filtdata(:,strmatch('R_Knee_Y', labels));
      R_Knee_Zdata=filtdata(:,strmatch('R_Knee_Z', labels));
      R_Quad_Xdata=filtdata(:,strmatch('R_Quad_X', labels));
      R_Quad_Ydata=filtdata(:,strmatch('R_Quad_Y', labels));
      R_Quad_Zdata=filtdata(:,strmatch('R_Quad_Z', labels));
      R_GT_Xdata=filtdata(:,strmatch('R_GT_X', labels));
      R_GT_Ydata=filtdata(:,strmatch('R_GT_Y', labels));
      R_GT_Zdata=filtdata(:,strmatch('R_GT_Z', labels));
      R_ASIS_Xdata=filtdata(:,strmatch('R_ASIS_X', labels));
      R_ASIS_Ydata=filtdata(:,strmatch('R_ASIS_Y', labels));
      R_ASIS_Zdata=filtdata(:,strmatch('R_ASIS_Z', labels));
      R_IlliacCrest_Xdata=filtdata(:,strmatch('R_SHO_X', labels));%The R_SHO and c7 channels were used for the illiac crest since normal illiac crest box malfunctioned%
      R_IlliacCrest_Ydata=filtdata(:,strmatch('R_SHO_Y', labels));
      R_IlliacCrest_Zdata=filtdata(:,strmatch('R_SHO_Z', labels));
      L_Toe_Xdata=filtdata(:,strmatch('L_Toe_X', labels));
      L_Toe_Ydata=filtdata(:,strmatch('L_Toe_Y', labels));
      L_Toe_Zdata=filtdata(:,strmatch('L_Toe_z', labels));
      L_Heel_Xdata=filtdata(:,strmatch('L_Heel_X', labels));
      L_Heel_Ydata=filtdata(:,strmatch('L_Heel_Y', labels));
      L_Heel_Zdata=filtdata(:,strmatch('L_Heel_Z', labels));
      L_Ank_Xdata=filtdata(:,strmatch('L_Ank_X', labels));
      L_Ank_Ydata=filtdata(:,strmatch('L_Ank_Y', labels));
      L_Ank_Zdata=filtdata(:,strmatch('L_Ank_Z', labels));
      L_5th_Xdata=filtdata(:,strmatch('L_5th_X', labels));
      L_5th_Ydata=filtdata(:,strmatch('L_5th_Y', labels));
      L_5th_Zdata=filtdata(:,strmatch('L_5th_Z', labels));
      L_Shin_Xdata=filtdata(:,strmatch('L_Shin_X', labels));
      L_Shin_Ydata=filtdata(:,strmatch('L_Shin_Y', labels));
      L_Shin_Zdata=filtdata(:,strmatch('L_Shin_Z', labels));
      L_Knee_Xdata=filtdata(:,strmatch('L_Knee_X', labels));
      L_Knee_Ydata=filtdata(:,strmatch('L_Knee_Y', labels));
      L_Knee_Zdata=filtdata(:,strmatch('L_Knee_Z', labels));
      L_Quad_Xdata=filtdata(:,strmatch('L_Quad_X', labels));
      L_Quad_Ydata=filtdata(:,strmatch('L_Quad_Y', labels));
      L_Quad_Zdata=filtdata(:,strmatch('L_Quad_Z', labels));
      L_GT_Xdata=filtdata(:,strmatch('L_GT_X', labels));
      L_GT_Ydata=filtdata(:,strmatch('L_GT_Y', labels));
      L_GT_Zdata=filtdata(:,strmatch('L_GT_Z', labels));
      L_ASIS_Xdata=filtdata(:,strmatch('L_ASIS_X', labels));
      L_ASIS_Ydata=filtdata(:,strmatch('L_ASIS_Y', labels));
      L_ASIS_Zdata=filtdata(:,strmatch('L_ASIS_Z', labels));
      L_IlliacCrest_Xdata=filtdata(:,strmatch('C7_X', labels));  %The R_SHO and c7 channels were used for the illiac crest since normal illiac crest box malfunctioned. C7 is left Illiac Crest and R_SHO is Right IC%
      L_IlliacCrest_Ydata=filtdata(:,strmatch('C7_Y', labels));
      L_IlliacCrest_Zdata=filtdata(:,strmatch('C7_Z', labels));
      L4_Xdata=filtdata(:,strmatch('L4_X', labels));
      L4_Ydata=filtdata(:,strmatch('L4_Y', labels));
      L4_Zdata=filtdata(:,strmatch('L4_Z', labels));
      R_hipangle = [];%Is it necessary to do a right  and left for each of  these  angles or  can I combine them somehow?%
      R_kneeangle = [];
      R_ankangle = [];
      L_hipangle = [];
      L_kneeangle = [];
      L_ankangle = [];
      startframe = 1; %Start Point%
      endframe = length(R_Toe_Xdata); %End Point%
      frame = startframe; %Current%
      startframe_new = frame+100
      while frame <= endframe
          R_pel_X = L4_Xdata(frame) - ((L4_Xdata(frame) - R_ASIS_Xdata(frame))*.5);
          R_pel_Y = L4_Ydata(frame) - ((L4_Ydata(frame) - R_ASIS_Ydata(frame))*.5);
          L_pel_X = L4_Xdata(frame) - ((L4_Xdata(frame) - L_ASIS_Xdata(frame))*.5);
          L_pel_Y = L4_Ydata(frame) - ((L4_Ydata(frame) - L_ASIS_Ydata(frame))*.5);
          R_trunkseg=atan2d((R_pel_Y-R_GT_Ydata(frame)),(R_pel_X-R_GT_Xdata(frame)));%Need to better convert Trunk Segment%
          R_thighseg=atan2d((R_GT_Ydata(frame)-R_Knee_Ydata(frame)),(R_GT_Xdata(frame)-R_Knee_Xdata(frame))); %DO I need to incorporate Z vector here?%
          R_shankseg=atan2d((R_Knee_Ydata(frame)-R_Ank_Ydata(frame)),(R_Knee_Xdata(frame)-R_Ank_Xdata (frame)));
          R_footseg=180+atand((R_Heel_Ydata(frame)-R_5th_Ydata(frame))/(R_Heel_Xdata(frame)-R_5th_Xdata(frame)));
          R_hipangle=[R_hipangle;(R_thighseg-R_trunkseg)];
          R_kneeangle=[R_kneeangle;(R_thighseg-R_shankseg)];
          R_ankangle=[R_ankangle;(R_footseg-R_shankseg-90)];
          L_trunkseg=atan2d((L_pel_Y-L_GT_Ydata(frame)),(L_pel_X-L_GT_Xdata(frame)));
          L_thighseg=atan2d((L_GT_Ydata(frame)-L_Knee_Ydata(frame)),(L_GT_Xdata(frame)-L_Knee_Xdata(frame))); %DO I need to incorporate Z vector here?%
          L_shankseg=atan2d((L_Knee_Ydata(frame)-L_Ank_Ydata(frame)),(L_Knee_Xdata(frame)-L_Ank_Xdata (frame)));
          L_footseg=180+atand((L_Heel_Ydata(frame)-L_5th_Ydata(frame))/(L_Heel_Xdata(frame)-L_5th_Xdata(frame)));
          L_hipangle=[L_hipangle;(L_thighseg-L_trunkseg)];
          L_kneeangle=[L_kneeangle;(L_thighseg-L_shankseg)];
          L_ankangle=[L_ankangle;(L_footseg-L_shankseg-90)];
          frame=frame+1;
      end
      figure(1)
      subplot(3,2,1)
      plot(R_hipangle(startframe:endframe))%Startframe_new allows collection to begin after 100 frames to avoid taking the max of a peak too early%
      hold on 
      [R_hipanglemax, index]=max(R_hipangle)
      plot(index,R_hipanglemax,'o')
      [R_hipanglemin, index]=min(R_hipangle)
      plot(index,R_hipanglemin,'o')
      hold off
      ylabel('R_ Hip Angle')
      subplot(3,2,3)
      plot(R_kneeangle(startframe:endframe))
      hold on 
      [R_kneeanglemax, index]=max(R_kneeangle)
      plot(index,R_kneeanglemax,'o')
      [R_kneeanglemin, index]=min(R_kneeangle)
      plot(index,R_kneeanglemin,'o')
      hold off
      ylabel('R_ Knee Angle')
      subplot(3,2,5)
      plot(R_ankangle(startframe:endframe))
      hold on 
      [R_ankanglemax, index]=max(R_ankangle)
      plot(index,R_hipanglemax,'o')
      [R_ankanglemin, index]=min(R_ankangle)
      plot(index,R_ankanglemin,'o')
      hold off
      ylabel('R_ Ankle Angle')
      subplot(3,2,2)
      plot(L_hipangle(startframe:endframe))
      hold on 
      [L_hipanglemax, index]=max(L_hipangle)
      plot(index,R_hipanglemax,'o')
      [L_hipanglemin, index]=min(L_hipangle)
      plot(index,R_hipanglemin,'o')
      hold off
      ylabel('L_ Hip Angle')
      subplot(3,2,4)
      plot(L_kneeangle(startframe:endframe))
      hold on 
      [L_kneeanglemax, index]=max(L_kneeangle)
      plot(index,R_kneeanglemax,'o')
      [L_kneeanglemin, index]=min(L_kneeangle)
      plot(index,L_kneeanglemin,'o')
      hold off
      ylabel('L_ Knee Angle')
      subplot(3,2,6)
      plot(L_ankangle(startframe:endframe))
      hold on 
      [L_ankanglemax, index]=max(L_ankangle)
      plot(index,L_hipanglemax,'o')
      [L_ankanglemin, index]=min(L_ankangle)
      plot(index,L_ankanglemin,'o')
      hold off
      ylabel('L_ Ankle Angle')
      %_____________________________________________________________________________________%
      %End Joint Angle Code
      %Start Force Plate Code
      [B,A]=butter(2,(2*50/2000)) %Filter%
      filtdataFxFP1=filtfilt(B,A,FxFP1)
      [B,A]=butter(2,(2*50/2000)) %Filter 2%
      filtdataFxFP2=filtfilt(B,A,FxFP2)
      [B,A]=butter(2,(2*50/2000)) %Filter%
      filtdataFyFP1=filtfilt(B,A,FyFP1)
      [B,A]=butter(2,(2*50/2000)) %Filter%
      filtdataFyFP2=filtfilt(B,A,FyFP2)
      [B,A]=butter(2,(2*50/2000)) %Filter%
      filtdataFzFP1=filtfilt(B,A,FzFP1)
      [B,A]=butter(2,(2*50/2000)) %Filter%
      filtdataFzFP2=filtfilt(B,A,FzFP2);
      rate_of_force_development = [];
      max_concentric_x=[];
      max_concentric_y=[];
      max_concentric_z=[];
        max_eccentric_x=[];
        max_eccentric_y=[];
        max_eccentric_z=[];
        force_development_x=[];
        force_development_y=[];
        force_development_z=[];
        % _______________________________________________________________________
        Fx_total=sqrt((FxFP1).^2 + (FxFP2).^2) %Unfiltered
        Fy_total=sqrt((FyFP1).^2 + (FyFP2).^2)
        Fz_total=sqrt((FzFP1).^2 + (FzFP2).^2)
        FP1_total=sqrt((FxFP1).^2 + (FyFP1).^2 + (FzFP1).^2) 
        FP2_total=sqrt((FxFP2).^2 + (FyFP2).^2 + (FzFP2).^2)
        FP_both_total=(sqrt((FxFP1).^2 + (FyFP1).^2 + (FzFP1).^2 + (FxFP2).^2 + (FyFP2).^2 + (FzFP2).^2))
        Fx_total_filt=sqrt((filtdataFxFP1).^2 + (filtdataFxFP2).^2) %Filtered
        Fy_total_filt=sqrt((filtdataFyFP1).^2 + (filtdataFyFP2).^2)
        Fz_total_filt=sqrt((filtdataFzFP1).^2 + (filtdataFzFP2).^2)
        FP1_total_filt=sqrt((filtdataFxFP1).^2 + (filtdataFyFP1).^2 + (filtdataFzFP1).^2)
        FP2_total_filt=sqrt((filtdataFxFP2).^2 + (filtdataFyFP2).^2 + (filtdataFzFP2).^2)
        FP_both_total_filt=(sqrt((filtdataFxFP1).^2 + (filtdataFyFP1).^2 + (filtdataFzFP1).^2 + filtdataFxFP2).^2 + (filtdataFyFP2).^2 + (filtdataFzFP2).^2)
        % ____________________________________________________________________________________
        [Max_conX_FP1,locs] = findpeaks(filtdataFxFP2, 'MinPeakProminence', 100) %Max Concentric FP1%
        [Max_conY_FP1,locs] = findpeaks(filtdataFyFP2, 'MinPeakProminence', 100)
        [Max_conZ_FP1,locs] = findpeaks(filtdataFzFP2, 'MinPeakProminence', 1000)
        [Max_conX_FP2,locs] = findpeaks(filtdataFxFP2, 'MinPeakProminence', 100) %Max Concentric FP2%
        [Max_conY_FP2,locs] = findpeaks(filtdataFyFP2, 'MinPeakProminence', 100)
        [Max_conZ_FP2,locs] = findpeaks(filtdataFzFP2, 'MinPeakProminence', 1000)
        [Max_conX_total,locs] = findpeaks(Fx_total_filt, 'MinPeakProminence', 100) %Max Concentric FP1 + FP2%
        [Max_conY_total,locs] = findpeaks(Fy_total_filt, 'MinPeakProminence', 200)
        [Max_conZ_total,locs] = findpeaks(Fz_total_filt, 'MinPeakProminence', 1000)
        [Max_conFP1_total,locs] = findpeaks(FP1_total_filt, 'MinPeakProminence', 1000)%Max Concentric FP1 total
        [Max_conFP2_total,locs] = findpeaks(FP2_total_filt, 'MinPeakProminence', 1000)%Max concentric FP2 total
        [Max_con_both_total,locs] = findpeaks(FP_both_total_filt, 'MinPeakProminence', 2000)%Max Concentric for all forces combined%
        % ____________________________________________________________________________________%
        figure(2) %Plotting Unfiltered Data of Both Force Plates in 3 Directions%
        title('Force Plate Data')
        subplot(4,3,1)
        plot(FxFP1, 'b')
        hold on
        plot(filtdataFxFP1, 'r')
        hold off
        ylabel('Fx of FP1')
        subplot(4,3,4)
        plot(FyFP1)
        hold on
        plot(filtdataFyFP1, 'r')
        hold off
        ylabel('Fy of FP1')
        subplot(4,3,7)
        plot(FzFP1)
        hold on
        plot(filtdataFzFP1, 'r')
        hold off
        ylabel('Fz of FP1')
        subplot(4,3,2)
        plot(FxFP2)
        hold on
        plot(filtdataFxFP2, 'r')
        hold off
        ylabel('Fx of FP2')
        subplot(4,3,5)
        plot(FyFP2)
        hold on
        plot(filtdataFyFP2, 'r')
        hold off
        ylabel('Fy of FP2')
        subplot(4,3,8)
        plot(FzFP2)
        hold on
        plot(filtdataFzFP2, 'r')
        hold off
        ylabel('Fz of FP2')
        subplot(4,3,3)
        plot(Fx_total)
        hold on
        plot(Fx_total_filt, 'r')
        hold off
        ylabel('Fx Sum')
        subplot(4,3,6)
        plot(Fy_total)
        hold on
        plot(Fy_total_filt, 'r')
        hold off
        ylabel('Fy Sum')
        subplot(4,3,9)
        plot(Fz_total)
        hold on
        plot(Fz_total_filt, 'r')
        hold off
        ylabel('Fz Sum')
        subplot(4,3,10)
        plot(FP1_total)
        hold on
        plot(FP1_total_filt, 'r')
        hold off
        ylabel('FP1 Total Sum')
        subplot(4,3,11)
        plot(FP2_total)
        hold on
        plot(FP2_total_filt, 'r')
        hold off
        ylabel('FP2 Total Sum')
        subplot(4,3,12)
        plot(FP_both_total)
        hold on
        plot(FP_both_total_filt, 'r')
        hold off
        ylabel('All Forces Total')
        FxFP1_invert=max(filtdataFxFP1) - filtdataFxFP1;  %Finding max eccentric peaks%
        FxFP2_invert=max(filtdataFxFP2) - filtdataFxFP2;
        FyFP1_invert=max(filtdataFyFP1) - filtdataFyFP1;
        FyFP2_invert=max(filtdataFyFP2) - filtdataFyFP2;
        FzFP1_invert=max(filtdataFyFP1) - filtdataFzFP1;
        FzFP2_invert=max(filtdataFyFP2) - filtdataFzFP2;
        FP1_total_invert=max(FP1_total_filt) - FP1_total_filt;
        FP2_total_invert=max(FP2_total_filt) - FP2_total_filt;
        Fx_total_invert=max(Fx_total_filt) - Fx_total_filt;
        Fy_total_invert=max(Fy_total_filt) - Fy_total_filt;
        Fz_total_invert=max(Fz_total_filt) - Fz_total_filt;
        FP_both_total_invert = max(FP_both_total_filt) - FP_both_total_filt;
        % ____________________________________________________________________________________
        figure(3) %Figure with inverted data for eccentric peaks%
        title('Inverted Force Plate Data')
        subplot(4,3,1)
        plot(FxFP1_invert)
        [Min_eccX_FP1,locs] = findpeaks(FxFP1_invert,'MinPeakProminence',200)
        ylabel('FxFP1')
        subplot(4,3,2)
        plot(FxFP2_invert)
        [Min_eccX_FP2,locs] = findpeaks(FxFP2_invert,'MinPeakProminence',200)
        ylabel('FxFP2')
        subplot(4,3,4)
        plot(FyFP1_invert)
        [Min_eccY_FP1,locs] = findpeaks(FyFP1_invert,'MinPeakProminence',200)
        ylabel('FyFP1')
        subplot(4,3,5)
        plot(FyFP2_invert)
        [Min_eccY_FP2,locs] = findpeaks(FyFP2_invert,'MinPeakProminence',200)
        ylabel('FyFP2')
        subplot(4,3,7)
        plot(FzFP1_invert)
        [Min_eccZ_FP1,locs] = findpeaks(FzFP1_invert,'MinPeakProminence',200)
        ylabel('FzFP1')
        subplot(4,3,8)
        plot(FzFP2_invert)
        [Min_eccZ_FP2,locs] = findpeaks(FzFP2_invert,'MinPeakProminence',200)
        ylabel('FzFP2')
        subplot(4,3,3)
        plot(Fx_total_invert)
        [Min_eccX_total,locs] = findpeaks(Fx_total_invert,'MinPeakProminence',200)
        ylabel('Fx Total')
        subplot(4,3,6)
        plot(Fy_total_invert)
        [Min_eccY_total,locs] = findpeaks(Fy_total_invert,'MinPeakProminence',200)
        ylabel('Fy Total')
        subplot(4,3,9)
        plot(Fz_total_invert)
        [Min_eccZ_total,locs]=findpeaks(Fy_total_invert,'MinPeakProminence', 400)
        ylabel('Fz Total')
        subplot(4,3,10)
        plot(FP1_total_invert)
        [Min_eccFP1_total,locs]=findpeaks(FP1_total_invert,'MinPeakProminence',400)
        ylabel('FP1 Total')
        subplot(4,3,11)
        plot(FP2_total_invert)
        [Min_eccFP2_total,locs]=findpeaks(FP2_total_invert,'MinPeakProminence',400)
        ylabel('FP2 Total')
        subplot(4,3,12)
        plot(FP_both_total_invert)
        [Min_ecc_both_total,locs] = findpeaks(FP_both_total_invert,'MinPeakProminence',200)
        ylabel('Max')
        %_____________________________________________________________________________________
        %Impulse
        Impulse_X_Total = (Fx_total_filt*(2*1/100))
        Impulse_Y_Total = (Fy_total_filt*(2*1/100))
        Impulse_Z_Total = (Fz_total_filt*(2*1/100))
        Impulse_FP1_Total = (FP1_total_filt*(2*1/100))
        Impulse_FP2_Total = (FP1_total_filt*(2*1/100))
        Impulse_Total = (FP_both_total_filt*(2*1/100))
        Impulse_FP1_X = (filtdataFxFP1*(2*1/100))
        Impulse_FP1_Y = (filtdataFxFP1*(2*1/100))
        Impulse_FP1_Z = (filtdataFxFP1*(2*1/100))
        Impulse_FP2_X = (filtdataFxFP2*(2*1/100))
        Impulse_FP2_Y = (filtdataFxFP2*(2*1/100))
        Impulse_FP2_Z = (filtdataFxFP2*(2*1/100))
        Impulse_Total = (FP_both_total_filt*(2*1/100))
        Impulse_X_Total_Max = max(Impulse_X_Total)
        Impulse_Y_Total_Max = max(Impulse_Y_Total)
        Impulse_Z_Total_Max = max(Impulse_Z_Total)
        Impulse_Total_Max = max(Impulse_Total)
        Impulse_FP1_Total_Max = max(Impulse_FP1_Total)
        Impulse_FP2_Total_Max = max(Impulse_FP2_Total)
        %___________________________________________________________________
        %Impulse Figure
        figure(4)      %Impulse Plot%
        title('Impulse')
        subplot(4,3,1)
        plot(Impulse_FP1_X)
        ylabel('pXFP1')  %Used P symbol to represent  impulse)
        subplot(4,3,2)
        plot(Impulse_FP2_X)
        ylabel('PXFP2')
        subplot(4,3,3)
        plot(Impulse_X_Total)
        ylabel('PXTotal')
        subplot(4,3,4)
        plot(Impulse_FP1_Y)
        ylabel('PYFP1')
        subplot(4,3,5)
        plot(Impulse_FP2_Y)
        ylabel('PYFP2')
        subplot(4,3,6)
        plot(Impulse_Y_Total)
        ylabel('PYTotal')
        subplot(4,3,7)
        plot(Impulse_FP1_Z)
        ylabel('PZFP1')
        subplot(4,3,8)
        plot(Impulse_FP2_Z)
        ylabel('PZFP2')
        subplot(4,3,9)
        plot(Impulse_Z_Total)
        ylabel('PZTotal')
        subplot(4,3,10)
        plot(Impulse_FP1_Total)
        ylabel('PFP1Total')
        subplot(4,3,11)
        plot(Impulse_FP2_Total)
        ylabel('PFP2Total')
        subplot(4,3,12)
        plot(Impulse_Total)
        ylabel('PTotal')
        %End WBB_ForcePateCodeUpdated9
        %_________________________________________________________________________________
        %Start WBB_Velocity_Acceleration_Code
        L4_Velocity_X = [];
        L4_Velocity_Y = [];
        L4_Velocity_Z = [];
        L4_Acceleration_X_FULL = [];
        L4_Acceleration_Y_FULL = [];
        L4_Acceleration_Z_FULL = [];
        startframe = 1; %Start Point%
        endframe = length(R_Toe_Xdata); %End Point%
        frame = startframe; %Current%
        L4_Velocity_X_FULL = zeros(endframe,1);
        L4_Velocity_Y_FULL = zeros(endframe,1);
        L4_Velocity_Z_FULL = zeros(endframe,1);
        L4_Acceleration_X_FULL = zeros(endframe,1);
        L4_Acceleration_Y_FULL = zeros(endframe,1);
        L4_Acceleration_Z_FULL = zeros(endframe,1);
        %____________________________________________________________________________________--
        %Redoing Loop for Ssome Joint Angles
        while frame <= endframe
            R_pel_X = L4_Xdata(frame) - ((L4_Xdata(frame) - R_ASIS_Xdata(frame))*.5);
            R_pel_Y = L4_Ydata(frame) - ((L4_Ydata(frame) - R_ASIS_Ydata(frame))*.5);
            L_pel_X = L4_Xdata(frame) - ((L4_Xdata(frame) - L_ASIS_Xdata(frame))*.5);
            L_pel_Y = L4_Ydata(frame) - ((L4_Ydata(frame) - L_ASIS_Ydata(frame))*.5);
            R_trunkseg=atan2d((R_pel_Y-R_GT_Ydata(frame)),(R_pel_X-R_GT_Xdata(frame)));%Need to better convert Trunk Segment%
            R_thighseg=atan2d((R_GT_Ydata(frame)-R_Knee_Ydata(frame)),(R_GT_Xdata(frame)-R_Knee_Xdata(frame))); %DO I need to incorporate Z vector here?%
            R_shankseg=atan2d((R_Knee_Ydata(frame)-R_Ank_Ydata(frame)),(R_Knee_Xdata(frame)-R_Ank_Xdata (frame)));
            R_footseg=180+atand((R_Heel_Ydata(frame)-R_5th_Ydata(frame))/(R_Heel_Xdata(frame)-R_5th_Xdata(frame)));
            R_hipangle=[R_hipangle;(R_thighseg-R_trunkseg)];
            R_kneeangle=[R_kneeangle;(R_thighseg-R_shankseg)];
            R_ankangle=[R_ankangle;(R_footseg-R_shankseg-90)];
            L_trunkseg=atan2d((L_pel_Y-L_GT_Ydata(frame)),(L_pel_X-L_GT_Xdata(frame)));
            L_thighseg=atan2d((L_GT_Ydata(frame)-L_Knee_Ydata(frame)),(L_GT_Xdata(frame)-L_Knee_Xdata(frame))); %DO I need to incorporate Z vector here?%
            L_shankseg=atan2d((L_Knee_Ydata(frame)-L_Ank_Ydata(frame)),(L_Knee_Xdata(frame)-L_Ank_Xdata (frame)));
            L_footseg=180+atand((L_Heel_Ydata(frame)-L_5th_Ydata(frame))/(L_Heel_Xdata(frame)-L_5th_Xdata(frame)));
            L_hipangle=[L_hipangle;(L_thighseg-L_trunkseg)];
            L_kneeangle=[L_kneeangle;(L_thighseg-L_shankseg)];
            L_ankangle=[L_ankangle;(L_footseg-L_shankseg-90)];
            frame=frame+1;
        end
        %_____________________________________________________________________________________________
        %Loop for Velocity and Acceleration
        startframe = 2; %Start Point%
        endframe = length(R_Toe_Xdata); %End Point%
        frame = startframe; %Current%
        while frame<endframe 
            L4_Velocity_Y = (L4_Ydata(frame+1)-L4_Ydata(frame-1))/(2*1/100);
            L4_Velocity_X = (L4_Xdata(frame+1)-L4_Xdata(frame-1))/(2*1/100);
            L4_Velocity_Z = (L4_Zdata(frame+1)-L4_Zdata(frame-1))/(2*1/100);
            L4_Acceleration_Y = ((L4_Ydata(frame+1)-2*L4_Ydata(frame)+L4_Ydata(frame+1))/((2*1/100).^2))
            L4_Acceleration_X = ((L4_Xdata(frame+1)-2*L4_Xdata(frame)+L4_Xdata(frame+1))/((2*1/100).^2))
            L4_Acceleration_Z = ((L4_Zdata(frame+1)-2*L4_Zdata(frame)+L4_Zdata(frame+1))/((2*1/100).^2))
        L4_Velocity_X_FULL(frame) = L4_Velocity_X;
        L4_Velocity_Y_FULL(frame) = L4_Velocity_Y;
        L4_Velocity_Z_FULL(frame) = L4_Velocity_Z;
        L4_Acceleration_X_FULL(frame) = L4_Acceleration_X;
        L4_Acceleration_Y_FULL(frame) = L4_Acceleration_Y;
        L4_Acceleration_Z_FULL(frame) = L4_Acceleration_Z;
            frame=frame+1;
        end
        %____________________________________________________________________________________________
        %Velocity and Acceleration Figure
        figure(5)                            
        title('Velocities and Accelerations')
        subplot(3,2,1)
        plot(L4_Velocity_Y_FULL)
        hold on
        [L4_Velocity_Y_Max, index]=max(L4_Velocity_Y_FULL)
        plot(index,L4_Velocity_Y_Max,'go')
        [L4_Velocity_Y_Min, index]=min(L4_Velocity_Y_FULL)
        plot(index,L4_Velocity_Y_Min,'o')
        hold off
        ylabel('L4 Velocity Y')
        subplot(3,2,2)
        plot(L4_Acceleration_Y_FULL)
        hold on
        [L4_Acceleration_Y_Max, index]=max(L4_Acceleration_Y_FULL)
        plot(index,L4_Acceleration_Y_Max,'go')
        [L4_Acceleration_Y_Min, index]=min(L4_Acceleration_Y_FULL)
        plot(index,L4_Acceleration_Y_Min,'o')
        hold off
        ylabel('L4 Accel Y')
        subplot(3,2,3)
        plot(L4_Velocity_X_FULL)
        hold on
        [L4_Velocity_X_Max, index]=max(L4_Velocity_X_FULL)
        plot(index,L4_Velocity_X_Max, 'go')
        [L4_Velocity_X_Min, index]=min(L4_Velocity_X_FULL)
        plot(index,L4_Velocity_X_Min,'o')
        hold off
        ylabel('L4 Velocity X')
        subplot(3,2,4)
        plot(L4_Acceleration_X_FULL)
        hold on
        [L4_Acceleration_X_Max, index]=max(L4_Acceleration_X_FULL)
        plot(index,L4_Acceleration_X_Max,'go')
        [L4_Acceleration_X_Min, index]=min(L4_Acceleration_X_FULL)
        plot(index,L4_Acceleration_X_Min,'o')
        hold off
        ylabel('L4 Accel X')
        subplot(3,2,5)
        plot(L4_Velocity_Z_FULL)
        hold on
        [L4_Velocity_Z_Max, index]=max(L4_Velocity_Z_FULL)
        plot(index,L4_Velocity_Z_Max, 'go')
        [L4_Velocity_Z_Min, index]=min(L4_Velocity_Z_FULL)
        plot(index,L4_Velocity_Z_Min,'o')
        hold off
        ylabel('L4 Velocity Z')
        subplot(3,2,6)
        plot(L4_Acceleration_Z_FULL)
        hold on
        [L4_Acceleration_Z_Max, index]=max(L4_Acceleration_Z_FULL)
        plot(index,L4_Acceleration_Z_Max,'go')
        [L4_Acceleration_Z_Min, index]=min(L4_Acceleration_Z_FULL)
        plot(index,L4_Acceleration_Z_Min,'o')
        hold off
        ylabel('L4 Accel Z')
  1 comentario
Walter Roberson
Walter Roberson el 1 de Nov. de 2017
In your line
plot(Table)
I do not know which variables that corresponds to, especially the associated data type? I do not find a variable of that name assigned in the code, and I do not see the 5,2 series of subplots in your code.

Iniciar sesión para comentar.

Respuestas (2)

KL
KL el 1 de Nov. de 2017
Editada: KL el 1 de Nov. de 2017
You should probably create a GUI with plots and table. As with all the other functionalities, there's great documentation and examples on how to create GUI. Check the below links.
For your case, something like this maybe,
  1 comentario
Samuel Halle
Samuel Halle el 2 de Nov. de 2017
Thanks for your answer but creating an app seems to be way above my skill level. I am fairly new to matlab. I just want to be able to place a table and a graph in the same figure.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 2 de Nov. de 2017
MATLAB has a couple of different things that use the same name "table".
table objects cannot be displayed in a gui as-is, and need to be converted to some other form.
uitable() graphics objects are good for display of data that is column-wise consistent. In your case you could have one column for description and another for numeric value (if they are all numeric). uitable() cannot be placed within an axes -- but they can be positioned where an axes would show up.
Another possibility is to create separate uicontrol('style', 'text') for each description and for each output. This gives flexibility about colors and formatting, but would typically be too much bother. uicontrol() cannot be placed within an axes -- but they can be positioned where an axes would show up.
A third possibility is to create an axes and to text() all the desired output into place. It is a bit tricky to get columns with text wrap working with this, but works fine if each string is sure to be shorter than the space available.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by