How can i do this by matlab ??
2
0
Entering edit mode
7.7 years ago

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 ??

matlab • 1.7k views
ADD COMMENT
0
Entering edit mode
7.7 years ago
Charles Yin ▴ 180

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
ADD COMMENT
0
Entering edit mode

this result the last column only in matrix ... i need all columns in one vector

ADD REPLY
0
Entering edit mode
7.7 years ago
Charles Yin ▴ 180

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
ADD COMMENT

Login before adding your answer.

Traffic: 2349 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6