Plot with loop separately all figures

1 view (last 30 days)
Ferial Assmani
Ferial Assmani on 1 Apr 2016
Commented: John BG on 2 Apr 2016
For reason of clarity, i want to plot separately all figures, thy mast be (Nbr_Position * Nbr_Case) plot, i have tried this but it does not work:
clear all; clc; close all;
V_Time = [1, 2, 3]; % Time Vector fixe length
%
V_Data = 1:1:12; % Data Vector
Nbr_Position = 2; % Nbr of position
Nbr_Case = 2; % Nbr of cases
%
N_Rows= length(V_Time); % Nbr of rows for matrix
N_columns= length(V_Data)/N_Rows; % Nbr of columns for matrix
M_Brut= (reshape(V_Data,[N_Rows,N_columns])) % Brut matrix from Data Vector
%
%
for i=1:N_columns % loop by position
figure
for j=1:Nbr_Case % loop by case
plot(V_Time',M_Brut(:,i)) % plot Time Vs M_Brut (Data i line)
end
title(['Position N°: ' num2str(i) ' &' ' Case ' num2str(j)]) % title
legend(['Case' num2str(j)]) % legend
end
  2 Comments
Chad Greene
Chad Greene on 1 Apr 2016
This seems to work for me. It creates four figures. What do you mean by "it doesn't work"?
John BG
John BG on 2 Apr 2016
tried in R2012 R2015a and R2016a and it works for me

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!