how can I extract first number of cell?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
skysky2000
el 16 de Jun. de 2017
Comentada: skysky2000
el 4 de Jul. de 2017
Dear All, I am facing problem that I have cell a ={[8,21,291,94,455,241,227,36,130] [15,248,455,241,227,36,130] [21,291,94,455,241,227,36,130] [36,130]} the question is: 1- how can I extract first number of each cell and put it as vector, expect answer is : c= [8 15 21 36];
2- how can I delete the first element of each cell and make others as vector without first element, expect answer is: d=[21,291,94,455,241,227,36,130,248,455,241,227,36,130,291,94,455,241,227,36,130,130]
Hope can you help me, Thanks alot
0 comentarios
Respuesta aceptada
C.J. Harris
el 16 de Jun. de 2017
a ={[8,21,291,94,455,241,227,36,130] [15,248,455,241,227,36,130] [21,291,94,455,241,227,36,130] [36,130]};
Question 1:
c = cell2mat(cellfun(@(x)(x(1)), a, 'UniformOutput', false));
Question 2:
d = cell2mat(cellfun(@(x)(x(2:end)), a, 'UniformOutput', false));
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!