How to output a cell array using fprintf?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sean Murphy
el 26 de Abr. de 2022
Comentada: Sean Murphy
el 26 de Abr. de 2022
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/978825/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/978830/image.png)
Here is the code I am running to call the program.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/978835/image.png)
The ommision of the semicolon on all outputs the array.
Thank you!
1 comentario
Respuesta aceptada
Chunru
el 26 de Abr. de 2022
% cell array
a = {'# To Select', 'Names', 'Barcodes', 'Prices'; 1, 'ABC', 1234, 4.5}
fprintf("%s\n", formattedDisplayText(a))
Más respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!