CellOrNoCellRef

Use it to reduce awkward constructs
1.8K Downloads
Updated 27 Jul 2005

No License

CELLORNOCELL Use it to reduce awkward constructs

Turn this awkward looking thing:

docnames = get(handles.popupmenu_ChooseReport,'String');
if iscell(docnames)
docname = docnames{get(handles.popupmenu_ChooseReport,'Value')};
else
docname = docnames;
end;

Into this

docnames = get(handles.popupmenu_ChooseReport,'String');
docname = CellOrNoCellRef(docnames, ...
get(handles.popupmenu_ChooseReport,'Value'));

See Also cell cellfun

Key words cell cellstring array matrix


It's not fancy, but it works

Cite As

Michael Robbins (2024). CellOrNoCellRef (https://www.mathworks.com/matlabcentral/fileexchange/8120-cellornocellref), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Cell Arrays in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0