Error with using sprintf
9 次查看(过去 30 天)
显示 更早的评论
% Write output to text file
fn = sprintf('%s_%s_.txt',filtered.SD,out.mys);
fid = fopen('.txt','wt');
fprintf('%.0f\n',n,x);
fclose(fid);
Error using sprintf
Function is not defined for 'cell' inputs.
Error in tSes (line 39)
fn = sprintf('$s_%s_.txt',filtered.SD,out.mys);
>>
I am getting the above error message using sprintf. What is wrong with the code? Any help is appreciated.
采纳的回答
Fangjun Jiang
2020-8-14
>> a={'abc'}
a =
1×1 cell array
{'abc'}
>> sprintf('%s',a)
Error using sprintf
Function is not defined for 'cell' inputs.
>> sprintf('%s',a{1})
ans =
'abc'
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!