this result the last column only in matrix ... i need all columns in one vector
• 0 views
•
link
I have matrix 100*100 and i get its lower triangle in file and read it by
(importdata) function in matlab , it is read file row by row and put it in
vector but i need to read it column by column and put it in vector
How can i do this by Matlab ??
you can try this:
M = dlmread('yorFileName.dat')
[r,c] = size(M); %get row and column values of data matrix
for i = 1 : c
vector = M(:, i);
end
this result the last column only in matrix ... i need all columns in one vector
You can try and test this:
M = dlmread('yorFileName.dat')
[r,c] = size(M); %get row and column values of data matrix
C=[]
for i = 1 : c
vector = M(:, i);
C = horzcat(C,vector);
end
Log in to answer this question.