I cannot extract data from syms surface plot: Struct contents reference from a non-struct array object
Show older comments
Hi!,
When I am trying to extract (x,y,z) data from a surface plot generated by the following code:
syms q_par_pipi_2 q_perp_pipi_2 Chi_xx_pipi_2
qx_pipi_2=q_par_pipi_2./sqrt(2);
Gamma_q_par_pi0_1=(1/2)*(cos(q_par_pi0_1)+1);
omega_bq_par_pi0_1=2*J*sqrt((1-Gamma_q_par_pi0_1)*(1+Gamma_q_par_pi0_1+J_perp_1/(2*J)));
omega_aq_par_pi0_1=2*J*sqrt((1+Gamma_q_par_pi0_1)*(1-Gamma_q_par_pi0_1+J_perp_1/(2*J)));
A1=q_perp_pi0_1*d/2;
B1=J*(1-Gamma_q_par_pi0_1)/omega_bq_par_pi0_1;
C1=(J*(1-Gamma_q_par_pi0_1)+(1/2)*J_perp_1)/omega_aq_par_pi0_1;
Chi_xx_pi0_1=(cos(A1)^2)*B1+(sin(A1)^2)*C1;
fsurf(Chi_xx_pi0_1,[0 1 0 1],'DisplayName','(pi,0), J_perp = + 0.5J',...
'Parent',axes1,...
'FaceColor',[0.749019622802734 0.749019622802734 0]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h = gcf; %current figure handle
axesObjs = get(h, 'Children'); %axes handles
dataObjs = get(axesObjs, 'Children'); %handles to low-level graphics objects in axes
%%get data
XX = dataObjs.XData ;
YY = dataObjs.YData ;
ZZ = dataObjs.ZData ;
I am getting the following error: Struct contents reference from a non-struct array object.
The plot is fine, but cannot extract any data.
The second part works normally with surface plots generated from non-syms generated plots.
Can you please help me understand? Is there any other way?
Accepted Answer
More Answers (1)
Subhrangsu Sarkar
on 20 Jan 2022
0 votes
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

