how to insert a single value in the matrix ?

4 visualizaciones (últimos 30 días)
pruth
pruth el 18 de Sept. de 2019
Respondida: pruth el 19 de Sept. de 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 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 18 de Sept. de 2019
What would be size of output matrix?
pruth
pruth el 18 de Sept. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

pruth
pruth el 19 de Sept. de 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');

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by