I want to export several cell arrays of string to a text file, using a loop, in a way very similar to the one explained in the following link:
http://www.mathworks.com/examples/matlab/1107-export-cell-array-to-text-file
The only difference is that everyone of the arrays has a different number of columns and I don't know how to tell formatspec to create that number of columns for each array in every iteration of the loop.
I need a command that tells
if myarray has 2 columns
formatSpec = '%s %s';
else if myarray has 3 columns
formatSpec = '%s %s %s\n';
else
...
I tried to simply set formatspec to 10 columns as the arrays don't contain more than that, but then the output file isn't organized in rows.
Thanks in advance for your help,