필터 지우기
필터 지우기

Datacursor to show Z axis String Info with Precise X axis information

조회 수: 3 (최근 30일)
Min
Min 2024년 3월 21일
편집: Voss 2024년 3월 26일
Hi, I am trying to show the Z axis string info when I click the cursor on the plot (3D).
But the problem is that, when I have just a normal (default) datacursor function, it shows the Z-axis string info as it is shown below.
But I had to change the function to show the precise time information which then caused the Z data to hide the string info and shows the actual value info.
formattedValue = [valueFormat num2str(value,10) removeValueFormat];
Now the function shows that the precise time information but the Z value doesn't show the string info.
I tried to change the Z information within the data cursor to show the string info
% If there is a z value, display it:
if length(pos) > 2
valueFormat = ' \color[rgb]{0 0.6 1}\bf';
removeValueFormat = '\color[rgb]{.25 .25 .25}\rm';
tickLabel = event_obj.Target.Parent.ZTickLabel(pos(3));
output_txt{end+1} = ['Z', valueFormat tickLabel{3} removeValueFormat];
% output_txt{end+1} = ['Z',formatValue(pos(3),event_obj)];
end
It shows that this is invalid.
Anyone has any idea what I should be doing?
Thanks!

채택된 답변

Voss
Voss 2024년 3월 21일
tickLabel is a scalar cell array, so don't index it with 3. Use 1 instead:
output_txt{end+1} = ['Z', valueFormat tickLabel{1} removeValueFormat];
  댓글 수: 6
Min
Min 2024년 3월 26일
Sorry that (3) was not intended since I was trying to figure out what was wrong with my code. After awhile, I found the problem!
My data was generated as a category tab not a Zticklabel for some reason.
Thanks for looking into this problem but it was a simple mistake that I wasn't aware of.
Thank you!
Voss
Voss 2024년 3월 26일
편집: Voss 2024년 3월 26일
You're welcome! Glad you got it sorted out.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by