combining cell array problem
3 views (last 30 days)
Show older comments
cell1={'a'}
cell2={[],'b'}
cell3={[],[],'c'}
cell4={[],[],[],'d'}
cell5={[],[],[],[],'e'}
how can i combine all these cells data.?
Desires result
cell={'a','b','c','d','e'}
0 Comments
Answers (2)
Andrei Bobrov
on 20 May 2015
Edited: Andrei Bobrov
on 20 May 2015
out1 = [cell1,cell2,cell3,cell4,cell5];
cell0 = cellstr(cat(1,out1{:}))'
1 Comment
Walter Roberson
on 20 May 2015
cell0 = {cell1{:},cell2{:},cell3{:},cell4{:},cell5{:}};
cell0(cellfun(@isempty,cell0)) = [];
5 Comments
Walter Roberson
on 20 May 2015
handles.answer = answer;
guidata(hObject, handles);
Then, in another routine where you wanted to use the value,
answer = handles.answer;
See Also
Categories
Find more on Loops and Conditional Statements 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!