change char class to string class

How to change the output from char class to string class ?
function Out=bestSection(Number,Letter,Grades)
[~,ind]=max(Grades);
Out=[num2str(Number(ind)),Letter(ind)];
end

1 件のコメント

Stephen23
Stephen23 2020 年 6 月 18 日
The most robust and efficient solution is to use sprintf, which also lets you specify the numeric conversion format.

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

 採用された回答

madhan ravi
madhan ravi 2020 年 6 月 18 日
編集済み: madhan ravi 2020 年 6 月 18 日

0 投票

doc string
doc compose % after Stephen's comment , make sure to use "" - double quotes

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2020 年 6 月 18 日

編集済み:

2020 年 6 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by