Effacer les filtres
Effacer les filtres

how to insert a single value in the matrix ?

2 vues (au cours des 30 derniers jours)
pruth
pruth le 18 Sep 2019
Réponse apportée : pruth le 19 Sep 2019
hey I am creating this csv file.
I have a matrix
a = [ 2 5 8 ; 5 6 8; 8 7 8 ]
here i just want to insert one value(number of rows) at in the first row, so it will shift the whole matrix one row down !
the output file should look like
3
2 5 8
5 6 8
8 7 8
actually what above i gave you is just an example. The Mat file which i have created is a 697*5.
i am converting it in csv format using csvwrite. but before converitng it into csv i want give a value of total number of rows (i.e 697 in this case) at the top.
the csv file should look like
3
2,5,8
5,6,8
8,7,8
  2 commentaires
KALYAN ACHARJYA
KALYAN ACHARJYA le 18 Sep 2019
What would be size of output matrix?
pruth
pruth le 18 Sep 2019
actually what above i gave you is just an example. The Mat file which i have created is a 697*5.
i am converting it in csv format using csvwrite. but before converitng it into csv i want give a value of total number of rows (i.e 697 in this case) at the top.

Connectez-vous pour commenter.

Réponse acceptée

pruth
pruth le 19 Sep 2019
hi,
i figured out the solution for this problem.
M = length(a(:,1))
dlmwrite('test.csv',M,'delimiter',',')
N = a;
dlmwrite('test.csv',N,'delimiter',',','-append');

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by