Effacer les filtres
Effacer les filtres

How can I save each column of a matrix as separate .dat file?

2 vues (au cours des 30 derniers jours)
Titli
Titli le 1 Août 2017
Commenté : KSSV le 1 Août 2017
I have a matrix of 40 columns. I want to save separate .dat files for each column. Can anyone help me with it?
Thanks in advance.
  2 commentaires
José-Luis
José-Luis le 1 Août 2017
Why do you want to do that? It is probably a bad idea. What are you trying to achieve?

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 1 Août 2017
Modifié(e) : KSSV le 1 Août 2017
A = rand(10,40) ;
for i = 1:size(A,2)
filename = strcat('column',num2str(i),'.txt') ;
c = A(:,i) ;
save(filename,'c','-ascii')
end
  1 commentaire
KSSV
KSSV le 1 Août 2017
Titli Saha comment moved here:
Thank you so much :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by