how to assign two variables in single cell

4 views (last 30 days)
Consider a cell in a matrix (2,2). I want to assign carbon concentration value as well as grain number value to that cell. How is it possible. Which data structure should I use. Please explain.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Jul 2015
datacell(2,2) = struct('carbon', [], 'grain', []);
now you can look at datacell(1,1).carbon, datacell(2,1).grain and so on.
datacell(1,2).carbon = 17;
datacell(2,2).grain = 9;
and so on.

More Answers (0)

Categories

Find more on Multidimensional Arrays 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!