How do I use fprintf to print a cell in a cell array?
Show older comments
Say I have a 1x1 cell array with the cell containing "Hi"
How do I use fprintf and this cell array in a script to print "Hi" in the command window?
Answers (2)
Use curly braces {} to address the cell array:
c = {"Hi"}; % String Variable
fprintf('%s',c{:})
c = {'Hi'}; % Character Vector
fprintf('%s',c{:})
.
A = {'hi'};
fprintf('%s\n',A{:});
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!