The error is : "未识别类 'matlab.graphics.primitive.Surface' 的方法、属性或字段 'DataTipTemplate'。"
Ältere Kommentare anzeigen
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";
Antworten (1)
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!
1 Kommentar
莹
am 19 Aug. 2024
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
