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 回表示 (過去 30 日間)
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 件のコメント
madhan ravi
madhan ravi 2019 年 3 月 15 日
not clear illustrate with an example
Bharath sagar Bangaru
Bharath sagar Bangaru 2019 年 3 月 15 日
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

サインインしてコメントする。

採用された回答

James Tursa
James Tursa 2019 年 3 月 15 日
編集済み: James Tursa 2019 年 3 月 15 日
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 件のコメント
Bharath sagar Bangaru
Bharath sagar Bangaru 2019 年 3 月 15 日
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 2019 年 3 月 15 日
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by