コマンドウインドウに配列を要素ごとに表示させる。
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
takeru misawa
el 21 de Sept. de 2021
Comentada: takeru misawa
el 22 de Sept. de 2021
Z = ([1, 2.254, 8]);
fprintf('%g', Z)
でコマンドウインドウの出力結果が
12.2548
となりますが、これを
1 2.254 8
となるようにするにはどのようにするべきでしょうか?
0 comentarios
Respuesta aceptada
Atsushi Ueno
el 21 de Sept. de 2021
Z = ([1, 2.254, 8]);
fprintf('%g ', Z)
num2str(Z) % fprintf以外の例
regexprep(num2str(Z),' +',' ') % 空白が多いので一文字にする
Más respuestas (1)
Atsushi Ueno
el 21 de Sept. de 2021
Editada: Atsushi Ueno
el 21 de Sept. de 2021
Z = ([1, 2.254, 8]);
Z % これでも「コマンドウインドウに配列を要素ごとに表示」出来るっちゃ出来る
format shortG; % 末尾のゼロを削除する為
Z
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!