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

2 views (last 30 days)
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?

Accepted Answer

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

More Answers (1)

Wasna Madushanka Ediri Arachchi
Edited: Wasna Madushanka Ediri Arachchi on 8 Dec 2017
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
Wasna Madushanka Ediri Arachchi
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.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!