how to plot first five numbers of data

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

 採用された回答

Jan
Jan 2021 年 5 月 29 日

0 投票

bar(a(1:5))

2 件のコメント

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

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

その他の回答 (0 件)

カテゴリ

質問済み:

2021 年 5 月 29 日

コメント済み:

Jan
2021 年 5 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by