combining cell array problem
古いコメントを表示
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'}
回答 (2 件)
Andrei Bobrov
2015 年 5 月 20 日
編集済み: Andrei Bobrov
2015 年 5 月 20 日
out1 = [cell1,cell2,cell3,cell4,cell5];
cell0 = cellstr(cat(1,out1{:}))'
1 件のコメント
Nouman Ashraf
2015 年 5 月 20 日
編集済み: Andrei Bobrov
2015 年 5 月 20 日
Walter Roberson
2015 年 5 月 20 日
cell0 = {cell1{:},cell2{:},cell3{:},cell4{:},cell5{:}};
cell0(cellfun(@isempty,cell0)) = [];
5 件のコメント
Andrei Bobrov
2015 年 5 月 20 日
out1 = [cell1,cell2,cell3,cell4,cell5];
cell0 = out1(~cellfun('isempty',out1));
Nouman Ashraf
2015 年 5 月 20 日
編集済み: Walter Roberson
2015 年 5 月 20 日
Walter Roberson
2015 年 5 月 20 日
Your variable "answer" exists only within the workspace of the callback function, and is destroyed afterwards. If you want the information to be remembered you need to store it somewhere else. http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
Nouman Ashraf
2015 年 5 月 20 日
Walter Roberson
2015 年 5 月 20 日
handles.answer = answer;
guidata(hObject, handles);
Then, in another routine where you wanted to use the value,
answer = handles.answer;
カテゴリ
ヘルプ センター および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!