Problem trying to remove numbers from plot axes

4 ビュー (過去 30 日間)
matthew
matthew 2013 年 1 月 30 日
I am trying to remove all numbers from the X- and Y- axes of a plot. However, there seems to be a problem with the 'set' functionality, despite previous threads indicating that problems had been fixed.
I'm running 64-bit matlab R2010b on a 64-bit windows machine.
Here is example code:
clc; close all; figure
plot([1:10,2:8],[9:-1:0,1:7],'.')
get(gca,'XTick') % this works okay
get(gca,'XTickLabel') % this works okay
set(gca,'XTickLabel',{[]}) % Subindex error
set(gca,'XTickLabel',[]) % Subscript error
set(gca,'XTick',[]) % Subscript error
set(gca,'xtick',[]) % Subscript error
With the last 4 lines I get error:
??? Subscript indices must either be real positive integers or logicals.
Or:
??? Error using ==> subsindex Function 'subsindex' is not defined for values of class 'cell'.
Am I doing this right?
Thanks,
Matthew
  2 件のコメント
Jan
Jan 2013 年 1 月 30 日
Is this the complete error message? Please care for copying all information from the message, because this most likely contian the solution of the problem already.
matthew
matthew 2013 年 1 月 30 日
it's the complete error. here's the printout from the command window:
>> set(gca,'XTickLabel',[]) % error ??? Subscript indices must either be real positive integers or logicals.
>> set(gca,'XTickLabel',{[]}) % error ??? Error using ==> subsindex Function 'subsindex' is not defined for values of class 'cell'.
>> set(gca,'XTick',[]) % error ??? Subscript indices must either be real positive integers or logicals.
>> set(gca,'xtick',[]) % error ??? Subscript indices must either be real positive integers or logicals.

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

採用された回答

Jan
Jan 2013 年 1 月 30 日
編集済み: Jan 2013 年 1 月 30 日
Did you define a variable called "set"? Check this by adding this before the failing command:
which set -all
Shadowing built-in functions in Matlab is a bad idea and leads to such bugs frequently.
  1 件のコメント
matthew
matthew 2013 年 1 月 30 日
ah, thanks so much... basic mistake.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by