The error is : "未识别类 'matlab.graphics.primitive.Surface' 的方法、属性或字段 'DataTipTemplate'。"
16 ビュー (過去 30 日間)
古いコメントを表示
In Primitive surface appearance and behavior - MATLAB (mathworks.com) ,I get that the surface has the DataTipTemplate attribute.
My code is as following:
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
s = surface(X,Y,Z);
s.DataTipTemplate.DataTipRows(1).Label = "SYM";
0 件のコメント
回答 (1 件)
Ayush
2024 年 8 月 5 日
From the code snippet provided by you as well as the error message shown, it seems that the data tip object is not present in the script thus it is being shown as unrecognized for the "DataTipTemplate" properties. I tried running the code provided to face the same error and to resolve this issue, you need to instantiate a "datatip" object first that creates a data tip and then use the "DataTipTemplate" properties to create your own custom data tips. You can refer to the below code snippet for your reference:
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
s = surface(X,Y,Z);
dt = datatip(s,64,142); % here you instantiate/create the data tip to be modified later using DataTipTemplate
s.DataTipTemplate.DataTipRows(1).Label = "SYM";
For more information on how to control the interactivity of a grahics object, in your case the data tip content, you can refer to the following documentations:
Hope this helps!
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
