How to print the string value using fprintf
24 ビュー (過去 30 日間)
古いコメントを表示
Hi,
a = (aa bb cc dd)
for ion = 1: 1: length (a)
and some lines of code
then later i have some functionality
---------------
p = a (ion);
Results if i use
fprintf ( "% 10s" , p);
error: fprintf: wrong type argument 'cell'
suppose if i use
disp (p)
output
{
[1,1] = aa
}
I just want the 'aa' as the output using fprintf only
How do i do that? Kindly help.
0 件のコメント
採用された回答
Rik
2020 年 4 月 22 日
The error message explains what is going on: you are trying to use a cell as input to fprintf. fprintf will not 'unpack' that for you, so you'll have to do it on your own:
fprintf ( "% 10s" , p{1});
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!