フィルターのクリア

instead of cellfun what should we us

1 回表示 (過去 30 日間)
Muhammad
Muhammad 2021 年 5 月 28 日
回答済み: Jan 2021 年 5 月 28 日
function compare_cases(country1,names,days,avg_days,dailycases)
IndexC = strcmpi(names,country1);
[row,col] = find(not(cellfun('isempty',IndexC)))
dailydata= dailycases(row,:);
bar(days(1:end-1),dailydata);
end
the error is coming like this in command window
>> compare_cases("China",names,days,430,dailycases)
Error using cellfun
cellfun works only on cells.
Error in compare_cases (line 4)
[row,col] =
find(not(cellfun('isempty',IndexC)))

採用された回答

Jan
Jan 2021 年 5 月 28 日
You can simply omit this line:
IndexC = strcmpi(names,country1); % This replies a Logical vector
% [row,col] = find(not(cellfun('isempty',IndexC)))
dailydata= dailycases(IndexC,:); % Use logical vector as index

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by