Reputation: 53
mat = [1,2,1;2,4,6;3,6,9];
mat =
1 2 1
2 4 6
3 6 9
plot(a(:,1), a(:,2), a(:,1), a(:,3));
I would like to know how it is done to plot the first column of mat to every other column of the matrix. But I don't want to do it like above mentioned. Is there a way to do it with any matrix with variable size.
Upvotes: 2
Views: 53
Reputation: 748
You can use a simple for loop:
for i = 2:size(mat,2)
plot(mat(:,1), mat(:,i));
hold all
end
Upvotes: 2