How to plot/use numerous values in single cell?

1 view (last 30 days)
I am incredibly new to Matlab, so any help would be appreciated!
I am given data in three rows of 8000 cells each with each cell having between 1 and 40 individual values. I need to plot these values on a scatter plot (each cell has either solely X, Y, or Z values that work with the corresponding values of the other rows to outline an object). So, how can I take the values inside each cell and make them individual/ungrouped values that can then be evaluated/plotted? If more information is needed, I'd be happy to elaborate. Thank you.

Accepted Answer

Kirby Fears
Kirby Fears on 8 Jun 2016
Brian,
This example should be a good starting point.
% Setting up some test data
x = rand(40,3);
data = cell(3,8000);
data(1,1) = {x(:,1)};
data(2,1) = {x(:,2)};
data(3,1) = {x(:,3)};
% Plotting first column of data cell in 3D scatter
scatter3(data{1,1},data{2,1},data{3,1});
Use curly brackets to unpack a double array from a cell. Check out the documentation for scatter3() .

More Answers (0)

Community Treasure Hunt

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

Start Hunting!