How to find a certain content with index in cell array by looping

2 ビュー (過去 30 日間)
Khaing Zin Htwe
Khaing Zin Htwe 2016 年 7 月 30 日
コメント済み: Khaing Zin Htwe 2016 年 7 月 31 日
Dear senior,
I have a cell array like the following code. I want to sort like the following answer . How can I solve this? Help me. Thanks all.
if true
% 4 [] [] []
5 6 [] []
7 8 9 10
Desired Answer: 1x1 cell
4
5
6
7
8
9
10
end

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 30 日
A={4 [] [] []
5 6 [] []
7 8 9 10}
B=A'
idx=~cellfun(@isempty,B)
out=B(idx)
  4 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 31 日
Use cell2mat
Khaing Zin Htwe
Khaing Zin Htwe 2016 年 7 月 31 日
it does not work well. The result is like 12555555x512. These contents are cell type. I want to convert all these contents to double 512x512 double . How can i do this ,sir. Please help me.

サインインしてコメントする。

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2016 年 7 月 30 日
B = A';
out = cat(1,B{:});

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by