Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

KSSV
KSSV am 8 Dez. 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

Weitere Antworten (1)

Wasna Madushanka Ediri Arachchi
Bearbeitet: Wasna Madushanka Ediri Arachchi am 8 Dez. 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 Kommentare
Stephen23
Stephen23 am 8 Dez. 2017
@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.
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by