Calling multiple cell elements at once

11 visualizaciones (últimos 30 días)
Orongo
Orongo el 15 de Feb. de 2019
Respondida: Orongo el 18 de Feb. de 2019
Hi I have a 1x10000 cell that I want to take out elements from. In my example here I use a 1x2 cell where I want to take out the first value C{1,1} and C{1,2}, and save it in a vector for a summation in a later stage. How can I do this?
C = {{1, 2, 3; 11,22,33;111,222,333},{1, 2, 3; 11,22,33;111,222,333}}
  8 comentarios
Stephen23
Stephen23 el 17 de Feb. de 2019
Orongo's "Answer" moved her:
Thansk all for the inputs so far, I have submitted a new question covering this but also considering other aspects of my program. I hope you can help me there. You find it here
https://uk.mathworks.com/matlabcentral/answers/445374-finding-in-a-cell-array-within-a-cell-array
Stephen23
Stephen23 el 17 de Feb. de 2019
@Orongo:please add explanation to this thread, by adding comments.
And remember to accept the answer of someone who helped you, not your own "answer" which does not actually answer the question but is really just a comment.

Iniciar sesión para comentar.

Respuestas (2)

Asieh Daneshi
Asieh Daneshi el 16 de Feb. de 2019
this is a 1*2 cell, which each element of it is a 3*3 matrix
you can call each element of the matrix using the following command
c{m,n}{p,q}
m and n are the column and row of the cell element, and p and q are the column and row of the matrix element.
you can use ":" to call multiple elements at once. for example: c{1,1}{1,1:3}
  4 comentarios
Orongo
Orongo el 17 de Feb. de 2019
I agree this is getting uneccesasy complicated and which I had saved the simulation better. The simulation takes long time to run, can I manipulate it anyhow to numeric arrays you mention?
Stephen23
Stephen23 el 17 de Feb. de 2019
Editada: Stephen23 el 17 de Feb. de 2019
"The simulation takes long time to run, can I manipulate it anyhow to numeric arrays you mention?"
Most likely, yes.
But as you have not uploaded your functions or explained anything about the algorithm that you use, we have no idea what your simulation does. I recommend that you review the introductory tutorials and also the documentation on arrays and vectorized code:

Iniciar sesión para comentar.


Orongo
Orongo el 18 de Feb. de 2019
Ok. It seems like I have to do a for loop, there is no other way.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by