Getting an error for setting gca tick marks

10 ビュー (過去 30 日間)
Brianna Florio
Brianna Florio 2018 年 7 月 9 日
コメント済み: Adam 2018 年 7 月 9 日
In my code, I have:
set(gca,'YTick',energy_pixel);
I'm getting an error message, saying: 'Value must be a vector of type single or double whose values increase'. However, the vector for 'energy_pixel' is:
[0, 0, 0, 0, 71, 188, 352, 595, 996]
Can someone tell me whats wrong? I can't change the values, so how can I work around this problem?
  3 件のコメント
Brianna Florio
Brianna Florio 2018 年 7 月 9 日
@Adam, I can see it doesn't increase, but I was hoping there was still a way to do this without manipulating the data. Do you know what I can do to work around this problem?
Adam
Adam 2018 年 7 月 9 日
I don't know what you are trying to do. Why do you want 4 ticks at 0?
set( gca, 'YTick', unique( energy_pixel ) )
may give what you want, but it's hard to say. If you really want 4 0's equally spaced at some interval along the x axis then you'll have to do something more involved because you are basically redefining the mapping of the x-axis to be non-linear.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by