directly use results of function
Mostrar comentarios más antiguos
I would like to get 'def' from something like:
(strsplit('abc.def.ghi','.'))(2)
I don't want to do this
r = strsplit('abc.def.ghi','.')
r(2)
is this possible?
1 comentario
Azzi Abdelmalek
el 9 de Jul. de 2014
Why you don't want to do?
r = strsplit('abc.def.ghi','.')
r(2)
Respuesta aceptada
Más respuestas (1)
Daniel
el 9 de Jul. de 2014
subsref(strsplit('abc.def.ghi','.'),struct('type','{}','subs',{{2}}))
The subsref function takes two arguments. The first is the data structure (in this case a cell array of strings) and the second is a structure with two fields: type and subs. Type contains the operator which will be used to index the data structure, and the subs field contains the index you want to access.
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!