how to plot first five numbers of data

3 views (last 30 days)
Muhammad
Muhammad on 29 May 2021
Commented: Jan on 30 May 2021
my workspace
named=names(:,1)
covvid=covid_cases(:,end)
[a,ind]=sort(covvid,'descend');
allindexes=length(a):1
bar(a)
set(gca, 'xticklabels', named(ind,:));
i want to plot only first 5 data values how i canmodify this so that it plot only first 5 data

Accepted Answer

Jan
Jan on 29 May 2021
bar(a(1:5))
  2 Comments
Muhammad
Muhammad on 29 May 2021
in x axes how i can plot fist five number of data ,remember that at x axes the data is string ,
Jan
Jan on 30 May 2021
Maybe you mean this:
[a, ind] = sort(covid_cases(:, end), 'descend');
bar(a(1:5))
set(gca, 'xticklabels', named(ind(1:5), 1));

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!