In the algorithm that I am dealing with, the nested cells are randomly generated in MATLAB. Consider this nested cell:
myCellArray ={2,2,1,1,{1,1,2,2,{1,2,{1,1,1,1,1}},2,2},{1,2,{1,2,2,2,2,2},2},{1,1},2,2,2,2,1,1,1,1,1};
The corresponding output of the cell is:
1×16 cell array
Columns 1 through 13
{[2]} {[2]} {[1]} {[1]} {1×7 cell} {1×4 cell} {1×2 cell} {[2]} {[2]} {[2]} {[2]} {[1]} {[1]}
Columns 14 through 16
{[1]} {[1]} {[1]}
Since the cell is generated randomly through an algorithm, I do not have access to the myCellArray
in its original format (i.e., the way you write it as a command) written above. I must find a way to write the cell in its original command in a .txt file.
Please let me know if you have any suggestion or comment. Thank you.