Check size of vector contained in two different cell array

3 ビュー (過去 30 日間)
Farshid Daryabor
Farshid Daryabor 2020 年 2 月 10 日
回答済み: Farhath Fatima 2020 年 2 月 12 日
How can I check if the vector size in the two different cell arrays is equal and then delete the array with different sizes compared to the reference/target vector?
For instance, the vector in cell arrays, called "A", compare to the target cell. I really thanks in advance any suggestion/comments

採用された回答

Farhath Fatima
Farhath Fatima 2020 年 2 月 12 日
Hi Farshid,
You can find the size of each column of cells A and Target as follows:
load('example.mat')
idx=cell2mat(cellfun(@(x) size(x), A, 'UniformOutput', false));
idx2=cell2mat(cellfun(@(x) size(x), Target, 'UniformOutput', false));
Idx returns sizes of columns of cell A. (For Example idx(1:2) returns size of column1,idx(3:4) returns sizes of column2 and so on..)
idx2 returns sizes of columns of cell Target
You can compare sizes, also compare values(by changing you equation in cell function) based on your requirement.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by