How to put these values into one array ?

1 次查看(过去 30 天)
I have this vector X which is equal to
X =
Columns 1 through 8
1 2 3 4 5 6 7 8
I want to convert it into this format
X =
1, 2, 3, 4, 5, 6, 7, 8
How can I achieve this ?

采纳的回答

KSSV
KSSV 2022-3-16
x = 1:8 ;
f = [repmat('%d,',1,length(x)-1),'%d\n'] ;
fprintf(f,x)
1,2,3,4,5,6,7,8
  15 个评论
KSSV
KSSV 2022-3-16
x = logspace(log10(1),log10(10),10);
f = [repmat('%.4f,',1,length(x)-1),'%.4f'] ;
fprintf(fid,['frequency points = "', f,'";'],x);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by