MATLAB Answers

I have a two dimensional mat file. i want to extract each row into seperate mat files ?

I have a two dimensional mat file. i want to extract each row into seperate mat files and name it accordingly. Can you pls make available a code?

  1 Comment

KSSV
2017 年 12 月 8 日
It can be done...but why you want to do that? You have everything already in a single mat ile.

Sign in to comment.

2 Answers

回答者: KSSV
2017 年 12 月 8 日
 採用された回答

A = rand(10) ;
n = size(A,1) ;
for i = 1:n
filename = strcat('row',num2str(i),'.mat') ;
Ar = A(i,:) ;
save(filename,'Ar') ;
end

  0 Comments

Sign in to comment.


編集済み: Wasna Madushanka Ediri Arachchi 2017 年 12 月 8 日

Thanks. kindly let me know how to concatenate each row if we have 3 matrices. I have already obtained seperate mat files for each row. Best
Madu

  4 Comments

Show 1 older comment
Stephen Cobeldick
2017 年 12 月 8 日
Wasna Madushanka Ediri Arachchi's "Answer" moved here:
I want to combine 3 different data sets together(Grey matter volumes+cortical thickness-L and cortical thickness-R) and do MVPA.(we can use .mat in software) Madu
Stephen Cobeldick
2017 年 12 月 8 日
@Wasna Madushanka Ediri Arachchi: sure, your question makes it clear that you want to combine data. I asked why you are splitting one .mat file into lots of separate .mat files, and then apparently loading these back into memory to perform some operations on. Unless you are reaching the limits of your memory there seems to be no point to this diversion.
I am quite new to Matlab..That is why I am using long pathways. anyway I extracted those data from original matrices and concatenated, Thanks Stephen.

Sign in to comment.