How do I get the last element of a cell array from a function call?
Show older comments
Say I am making a function call to a function that needs an index as one of its arguments, however, in this case, I only want the last element of the cell array. So far I have this:
twin_start = boundary_times(df,steplists,stepIdx,full_step_str,end);
using end as an argument, but I know you can't use end like that. Is there something I can do to indicate that I want the last element of the cell array when making a function call? Thank you :)
2 Comments
Rik
on 15 Jul 2018
You mean you want only the last element of your output array? I have no idea what kind of input boundary_times is expecting, so I can't tell if you should use some call to numel or something totally different.
Elizabeth Cisneros
on 15 Jul 2018
Accepted Answer
More Answers (1)
Image Analyst
on 15 Jul 2018
Try this:
% Put contents of last cell of the twinSplit cell array into step_BoundaryT
step_BoundaryT = twinSplit{end};
1 Comment
Elizabeth Cisneros
on 15 Jul 2018
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!