フィルターのクリア

Trying to print a vector.

4 ビュー (過去 30 日間)
Manuel López
Manuel López 2020 年 11 月 21 日
コメント済み: Manuel López 2020 年 11 月 21 日
Hi everyone. I'm trying to print a vector as follows:
fprintf(doc,'k0 = [%.3f %.3f %.3f %.3f].',k0);
where k0 is a 4-dimensional vector with numerical components and doc is a .txt document. Nonetheless, I would want to print any other vector k0 without making explicit reference to its dimension. I mean, I would like to change de dimension of k0 and not changing the code. Can someone help me?
Thanks!

採用された回答

dpb
dpb 2020 年 11 月 21 日
fprintf(doc,['k0 = ' repmat('%.3f ',1,numel(k0)) '.'],k0);
  1 件のコメント
Manuel López
Manuel López 2020 年 11 月 21 日
Thank you :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by