comparison the data and ploting it

i have these arrays in work space
names 332*2 cell
daily_cases 332*430 double
note :
names include countries names in first column and states in 2nd column
daily_cases indclude daily covid cases
important ; for example 'canada ' is located in location (1;20) in names cell and its data is located in 'daily_cases' at same location (1;20)
i want the function which take random country name as input the make the plot of dailycases vs country name
function(country, names,dailycases)
end
it should be generic so that it plot the data of any country which i enter while calling

답변 (1개)

Jan
Jan 2021년 5월 27일
편집: Jan 2021년 5월 27일

0 개 추천

function ShowCases(country, names, dailycases)
index = any(strcmpi(names, country), 2); % 1st or 2nd column
if any(index)
plot(dailycases(index, :));
else
fprintf(2, 'No matching country found for: "%s"\n', country);
end
end

댓글 수: 1

Muhammad
Muhammad 2021년 5월 27일
index that is in line 2 has double format
i want it in array want
index{..........} so how can i

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

질문:

2021년 5월 27일

댓글:

2021년 5월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by