I have a matrix eg [1,6,3], and i have a 31*1 cell array ,each element of cell is a matrix. My problem is i wants to extract matrix from the cell position {1*1},{6*1},{3*1} and to be stored all these in separate matrices.

1 view (last 30 days)
I use the loops and values ​​but I can not seperate and store each iteration values ​​as matrices please help me for this problem
Cell Assigned_P = (31 * 1)
  2 Comments
Bharath sagar Bangaru
Bharath sagar Bangaru on 15 Mar 2019
i have a cell =C size (31/1) each element is a matrix of 3D point data. I have a matrix of X=[7, 6 ,5,8] values varying from 1-31.i want to extract element (7,1),(6,1),(5,1),(8,1) in the form of seperate matrix each.so that i can use this matrix values to plot a 3d graph.
As i use Q=C(X) gives me anothe cell with required data . If i use cell2mat() that gives me whole as on matrix .
but i wants to store each required cell in a seperate matrix that is used later for surface plot.
i use tha following code results a cell array
Adapted_P= P_giacitura(row)
Adapted_P =
4×1 cell array
{8532×8 double}
{2476×8 double}
{8532×8 double}
{8912×8 double}
please help me in this regard so far i am trying this,if i dont do this i dont even move single step ahed for my project.
thankig you

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 15 Mar 2019
Edited: James Tursa on 15 Mar 2019
E.g., is this what you want?
c = your 31x1 cell array
v = your vector of indexes, e.g. [1,6,3]
result = c(v); % extract the cell elements according to the indexes in v
Not sure why you want the results in separate variables. It is much simpler to access the results as simply result{1}, result{2}, and result{3}, etc.
  2 Comments
Bharath sagar Bangaru
Bharath sagar Bangaru on 15 Mar 2019
in my question the index vector is varied in between 1 and 31 .And eah element in cell is a matrix with lot of dat points.later i wants to use this information for the graph.All i want is if i give index vector as input ,i need out as index position matices in the cell automatically.I try to use For clearloop but i is not storing the matrices separately.
Thanks for the response.I hope with this it is
Bharath sagar Bangaru
Bharath sagar Bangaru on 15 Mar 2019
hi sir thank you it works for my code.And only remaining thing is i wants to draw a 3D graph based on this cell matrices.The code gives me 3*1 cell array.each one cell shoul give one graph.
thank you

Sign in to comment.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!