What does gca mean?

조회 수: 13 (최근 30일)
michelle Ormanns
michelle Ormanns 2016년 11월 8일
댓글: John D'Errico 2024년 8월 18일
hello together, I'm a Beginner and I have a friends' skript and I'm trying to understand it.
1.)I don't really understand the "set"/"get" programmation als well as the "gca"/the "1" in the first line...
2.) Furthermore I didn't understand what the: {\it t} stands for (last line)...
for a Diagramm he wrote:
set(gca,'XGrid','on', 'YGrid', 'on', 'Fontsize', 16, 'linewidth', 1)
x_axis = get(gca, 'xtik');
xlabel('time{\it t} [s]')
I've already been searching for this question, but too many other questions without any correlation to this theme were found...
Thanks!

답변 (2개)

Jan
Jan 2016년 11월 8일
편집: Jan 2016년 11월 8일
I agree with John: Only reading the manual will really help.
But this is a forum for Matlab related questions and all questions are welcome. Therefore:
gca replies the "handle" of the currently active axes object. A "handle" is a kind of address to identify all graphic objects. With set and get you can change or obtain properties of the graphic object.
Try this in the command window:
H = axes
get(H)
get(H, 'XColor')
set(H, 'XColor', [1,0,0]);
get(H, 'XColor')
'{\it t}' is a LaTeX string, which displays the "t" in italics. Search for "latex" in the documantation:
docsearch latex
Note that "get(gca, 'xtik')" will fail, because the property is called "xtick".

John D'Errico
John D'Errico 2016년 11월 8일
편집: John D'Errico 2016년 11월 8일
Is there a reason why you would not just try
help gca
or better,
doc gca
RTFM. When you have a question about a MATLAB function, the fastest way to answer the question is by using the existing help. Well written, by professionals.
gca: Get handle to current axis.
I think your real problem is you have no idea how handle graphics works, based on your comments. Again, read the help. The help docs discuss the concept of "Graphics Objects".
  댓글 수: 3
Walter Roberson
Walter Roberson 2024년 8월 18일
This message is discouraging the OP and others from asking questions and is rather talking about how stupid and illiterate the OP is. No one is perfect and forums exist for all questions , while help and doc do help , its not always understandable especially for a beginner , so other the rant , explanation could have been done.
John D'Errico
John D'Errico 2024년 8월 18일
I'm sorry, but I disagree. It points out that the very best and fastest way to get an explanation for some function is to use the help already provided in MATLAB. You get an answer immediately, complete with mutliple examples, especially if you use the doc facility in MATLAB. This is certainly true for GCA.
In the case of the second question: 2.) Furthermore I didn't understand what the: {\it t} stands for (last line)... The answer is probably less obvious.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by