フィルターのクリア

Is there any function which returns the content of a variable as string?

1 回表示 (過去 30 日間)
Ray Lee
Ray Lee 2016 年 3 月 14 日
回答済み: Walter Roberson 2016 年 3 月 15 日
We have to know the data type when using `sprintf` and it can convert limited types to string.
disp(var) can show the content of a variable of any type but it doesn't return anything.

採用された回答

Walter Roberson
Walter Roberson 2016 年 3 月 15 日
evalc(var)
or
evalc(disp(var))
The result will be a string that might well have newlines in it. Also note that if you have struct or cell array components, then strings or vectors that are more than a few characters might get summarized like '[1 x 17 double]'

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2016 年 3 月 14 日
編集済み: Fangjun Jiang 2016 年 3 月 14 日
num2str();
mat2str()

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by