Pulling specific data from 2 different matrices, and starting a new matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a global matrix A of 4 column vectors and i've subsequently constructed 2 separate matrices X and Y from the 1st 2 columns of the global matrix. I want to construct a 3rd matrix using info from the 2 matrices X and Y. the statement will read value from X and Y then match these values in the global matrix A and read off the corresponding value from the 3rd column of A. Can someone advise on the best way to tackle this as my if else if statements are not working. Thats as far as ive got up to. Thanks Ernest
A = importdata(filename,delimiterIn,headerlinesIn);
%% Column vectors%%%%
x= A.data(:,1);
y= A.data(:,2)';
u =A.data(:,1:3);
v= A.data(:,4);
%% Matrices%%%%
n= length(A.data);
Mat_x= repmat(x,1,n); % 1 means the first element in the column is repeated in the row then the 2nd element repeated etc
Mat_y= repmat(y,n,1);
%% U population statement
u_rows= n;
u_col= n;
Mat_u= zeros(u_rows,u_col);
for c= 1: u_col
for r= 1:u_rows
if
Mat_u(r,c)= u(r,c)
Réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!