Display a cell in an fprintf?
이전 댓글 표시
I'm using an array from an Excel spreadsheet, and am trying to display a 1x1 cell output. However, fprintf doesn't support cell array arguments. When I use it, I get the message,
"Error using fprintf
Function is not defined for 'cell' inputs."
Is there another function I could use to display the cell? Or would I need to convert it to another form before I can use it?
답변 (1개)
What you would normally do with a cell and fprintf() is dereference the cell into its contents. Watch out that if you have fewer % format items than entries in the matrix that the format will be repeated as many times as required to output all of the items.
C = {[1], [2 3]}
fprintf('%d,', C{1}); fprintf('\n')
fprintf('%d,', C{2}); fprintf('\n')
카테고리
도움말 센터 및 File Exchange에서 Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!