How to output a cell array using fprintf?
22 次查看(过去 30 天)
显示 更早的评论
I am trying to figure out how to output this cell array from Excel using fprintf in my program. I would like to keep the same format. I keep getting errors saying that the function is not defined for cell inputs and get the same using sprintf and I'm not sure on how to convert it
Here is my array in Excel and in MATLAB Command window.
Here is the code I am running to call the program.
The ommision of the semicolon on all outputs the array.
Thank you!
采纳的回答
Chunru
2022-4-26
% cell array
a = {'# To Select', 'Names', 'Barcodes', 'Prices'; 1, 'ABC', 1234, 4.5}
fprintf("%s\n", formattedDisplayText(a))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!