I am trying to read the contents of a 512*512 matrix of class uint32 to a text file. This matrix has 0s and 1s as its contents. The below code keeps returning me this error: "Cell contents reference from a non-cell array object."
fileID = fopen('my_data.txt','w');
[nrows,ncols] = size(matri_working_now);
for row = 1: nrows
fprintf(fileID,matri_working_now{row,:});
end
Any suggestions/ideas?
Thanks!!
try replacing
fprintf(fileID,matri_working_now{row,:});
with
fprintf(fileID,matri_working_now(row,:));
It seesm like you are trying to access matri_working_now
as a cell using curly braces {}
, while you should access it as a regular matrix using parentheses ()
.