write a code that plots vectors in a matrix one by one. Everytime a vector is plotted I want to have an option to store in to a one of three (new) matrices eaither by clicking or pressing the keyboard. [MATLAB]
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
clear, clc
M=randi([1,10],3,10);
[m,n]=size(M);
M1=[];
M2=[];
M3=[];
for i=1:n
plot3([0,M(1,i)],[0,M(2,i)],[0,M(3,i)]);
hold on;
fprintf('For %d vector, in which matrix do you want to put this
vector: ');
ch=input('Press 1 for 1, 2 for 2 or 3 for 3: ');
if(ch==1)
M1=[M1 M(:,i)];
elseif(ch==2)
M2=[M2 M(:,i)];
else
M3=[M3 M(:,i)];
end
end
disp('First matrix is');
disp(M1);
disp('Second matrix is');
disp(M2);
disp('Third matrix is');
disp(M3);
Kindly revert for any queries
Thanks.
Get Answers For Free
Most questions answered within 1 hours.