How to plot data contains only ones?

1 回表示 (過去 30 日間)
Brave A
Brave A 2020 年 11 月 21 日
コメント済み: Brave A 2020 年 11 月 21 日
Hi
How to plot data contains only ones?
I have txt file contains 1 1 1 1 1 1 only ones. and I want to represent it like
x-axis contains all user numbers
y-axis contains selected user where they represent it by : 1 ones. any suggestions to represent? bevause any time I tries I got line in the middle.
Thanks in advance!

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 11 月 21 日
編集済み: KALYAN ACHARJYA 2020 年 11 月 21 日
user_number=20;
test_data=ones(1,user_number);
plot(1:user_number,test_data);
And yes, you definitely find the straight line (horizontal), because all the values ​​of the y-axis are the same here. To load the data from text file, you can user load function with complete filename.
  19 件のコメント
Brave A
Brave A 2020 年 11 月 21 日
I have another data set same like this how to plot with cumsum? because it's combiened then in one line.
Brave A
Brave A 2020 年 11 月 21 日
I think I got what I need ! Big thanks both of you.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by