How to get a content of a cell array?
Afficher commentaires plus anciens
I have 1x25 cell array, which looks like this :
0.300000 0.410000 ,0.41000 0.430000 ,...
I want to get only first element from the first cell ( 0.300000 ) and put in a variable x, and second element from the first cell (0.410000) and put it into a variable y. How can I do it?
Réponse acceptée
Plus de réponses (1)
Easwar Kumar Yarrabikki
le 15 Fév 2017
Hello Lara,
You can do something like
C = { 0.300000 0.410000 ,0.41000 0.430000 }; % your Cell
x=C{1,1} % extracting first element
y=C{1,2} % extracting second element
z=C{1,3} % extracting first element
you can write a simple loop to extract all data at once, if you have very large data.
3 commentaires
Lara Lirnow
le 15 Fév 2017
Easwar Kumar Yarrabikki
le 15 Fév 2017
Hello Lara.., I tried it once Before I actually Post it, Worked fine. I attached screen shot of my work space below .

emjey
le 18 Fév 2020
How do I extract first two elements, or the second and third at the same time?
Catégories
En savoir plus sur Multidimensional Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!