Clear Filters
Clear Filters

how to nest cell array

3 views (last 30 days)
david Pham
david Pham on 1 Jul 2018
Answered: Sri Harish G on 2 Jul 2018
i have a 1x36 cell array how do i make it so that if i were to click on the 1x36 cell array each of the 36 values in the row would be a 1x1 cell. Also the "values" are names of units for example "psi" so they are all text no numbers.
im looking to keep the 1x36 cell array and all the 36 1x1 cells
  3 Comments
david Pham
david Pham on 1 Jul 2018
in my workspace "A" is a 1x36 cell array, the values are just units like psi, velocity, density and so on for 36 columns.
i want it so that once i click on the 1x36 cell array in my workspace itll show a 1x1 cell for psi and all the other 36 units.
Jan
Jan on 1 Jul 2018
It does not get clearer. What does "the values are just units like psi, velocity, density" mean? Using valid Matlab syntax is preferred in this forum. I guess:
A = {'psi', 'velocity', 'density'}
What are "names of units". The "workspace" is the list of the variables in the currently running function. Do you mean the "workspace browser"? What does "show a 1x1 cell for psi" mean? Where should be shown what?
Please try to describe your problem more clearly.

Sign in to comment.

Answers (1)

Sri Harish G
Sri Harish G on 2 Jul 2018
If you want to store each of the units in a separate cell you could define your variable as
A={{'psi} {'velocity'} {'density'}};
This way when accessing A{1}
>>A{1}
ans =
1X1 cell array
{'psi'}
>>A{1}{1}
ans =
'psi'

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!