Hi Matlabers.. Can you help me? I want to export cell data into a text file. But number of cells in every row is a variable. I've tried to use 'fprintf', but the thing is, if number of cells in every row is variable, of course value in formatSpec should be flexible, depends on variable too (cmiiw). Please look at this following pict..
this data..
I want to export into a text file till like this..
the text file have to suit with this specific details:
- every data in each cells separated using one space
- every cells in each row separated using tab-space
like I said, I've tried to use function 'fprintf', with details code..
fileID = fopen('result.txt','w'); formatSpec = '%d %d %d %d %d %d \n'; [nrows,ncols] = size(pop3); for row = 1:nrows for col = 1:ncols fprintf(fileID,formatSpec,pop3{row,col}); end end
and the result is..
I know (one of) my fault(s) is the formatSpec, but I have no idea what should I do to make the output text file meets to 2 specific details I explained before.
I need you guys to help me for any suggestion for this case.. Thankyou..
Dimas, Indonesia.
Best Answer