The MATLAB interpreter loads your code and executes it using the Read-Evaluate-Print-Loop (see REPL).
In this problem you will go the opposite way; given an in-memory MATLAB cell-array can you convert it to legal MATLAB code?
i.e. if you have the cell array,
x={{'MLB',{'Red Sox','Yankees'},{'Rangers','Cardinals'}},{'NFL',{'Cowboys','Giants'},{'Patriots','49ers','Ravens'}}}
write a function that returns the string,
y = '{{''MLB'', {''Red Sox'', ''Yankees''}, {''Rangers'', ''Cardinals''}}, {''NFL'', {''Cowboys'', ''Giants''}, {''Patriots'', ''49ers'', ''Ravens''}}};'
which on 'eval(y)' can reconstruct x.
Also specialize to handle multiple levels of cell-arrays, and mixed string/double types.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers10
Suggested Problems
-
Find relatively common elements in matrix rows
2151 Solvers
-
2524 Solvers
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
1988 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
13697 Solvers
-
Find names/words that start and end with the same letter.
38 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!