how to insert a single value in the matrix ?

4 ビュー (過去 30 日間)
pruth
pruth 2019 年 9 月 18 日
回答済み: pruth 2019 年 9 月 19 日
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 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 18 日
What would be size of output matrix?
pruth
pruth 2019 年 9 月 18 日
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.

サインインしてコメントする。

採用された回答

pruth
pruth 2019 年 9 月 19 日
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');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by