How to extract last element from the lists
Afficher commentaires plus anciens
Suppose if my List has
list = {[1,2],2,[],[1,2,3]}
eg:
list{1} = [1,2] = %% print last element ==>> 2 list{2} = 2 list{3} = [] list{4} = [1,2,3] ==> 3 new_list = {2,2,[],3}
I need to extract last element from each list{i} Output should be like
new_list = {2,2,0,3}
4 commentaires
dpb
le 29 Avr 2018
For what definition of nth element, pray tell? You have vectors of numel() = 2,1,0,3 for the cells and the ordinal position of your proposed solution is 1,1,[],3 which is, if anything, consistent in there is no consistency observable as to which is to be recalled (other than the third with no alternative available).
Aswin Sandirakumaran
le 29 Avr 2018
dpb
le 29 Avr 2018
That's not what the original said; no fair changing the problem and then acting like didn't... :)
Aswin Sandirakumaran
le 30 Avr 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Graphics Performance 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!