MATLAB: Plotting selected columns of a matrix

columsmatrixplot

I have a 32×1544 matrix.
I want to plot the 1st 8 column as plot1, 2nd 8 columns as plot2 and the 3rd 8 columns as plot3.
So all the 3 seperate plots are 32×8 2D-plot
Please advise. Thanks

Best Answer

I am not certain what you want as the result.
Try this:
M = rand(32,24) + (1:24); % Create Matrix
x = 1:32; % Independent Variable Vector
figure
for k = 1:3
subplot(3,1,k)
plot(x, M(:,(1:8)+(k-1)*8))
grid
end
Substitute your own matrix for ‘M’, and your independent variable vector for ‘x’.
Related Question