フィルターのクリア

if I want to save a formatted string to memory, but not to print it out, what command(s) would I use?

4 ビュー (過去 30 日間)
fprintf, sprintf, disp, or echo?
I know that fprintf and sprintf create formatted strings and disp does print out so I'm confused on what the answer would actually be.
thank you!

回答 (1 件)

Star Strider
Star Strider 2015 年 8 月 14 日
I would save the output of sprintf to a cell array:
For example:
for k1 = 1:5
out{k1,:} = sprintf('This is iteration #%d', k1);
end
Experiment to get the result you want.
  1 件のコメント
Star Strider
Star Strider 2015 年 8 月 14 日
I did the second originally, but changed it to the first because it then becomes a column vector, and it was easier to read it and verify that it works. The code works either way.

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

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by