How to fix the "Improper index matrix reference" error in my Data Extraction coding?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to extract data from the MATLAB figure named "NF power_Aulayers_etch_glass-by-glass_xz" as attached. But, when I run the code, it doesn't extract the data, rather it shows "Improper index matrix reference" this message. So, how do I resolve the error and extract data from the figure?
//
fig = openfig('NF power_Aulayers_etch_glass-by-glass_xz.fig');
Extracted_data = findobj(fig,'-property','XData','-property','YData','-property','Zdata');
x = Extracted_data(1).XData;
y = Extracted_data(1).YData;
z = Extracted_data(1).ZData;
//
0 Kommentare
Antworten (1)
dpb
am 1 Aug. 2021
Bearbeitet: dpb
am 2 Aug. 2021
hF=openfig('NF power_Aulayers_etch_glass-by-glass_xz.fig');
hAx=hF.Children; % the axes object handle
hS=hAx.Children; % the children of the axes 2-array
hS=hS{2}; % the surface handle is second of the two
X=hS.XData;
etc., ...
Given the roundabout of the above, I'd suggest the more direct
>> hS=findobj(hF,'type','surface')
hS =
Surface with properties:
EdgeColor: 'none'
LineStyle: '-'
FaceColor: 'flat'
FaceLighting: 'flat'
FaceAlpha: 1
XData: [251×1 double]
YData: [81×1 double]
ZData: [81×251 double]
CData: [81×251 double]
Show all properties
>>
or your original will result in same thing--
>> hS=findobj(hF,'-property','XData')
hS =
Surface with properties:
EdgeColor: 'none'
LineStyle: '-'
FaceColor: 'flat'
FaceLighting: 'flat'
FaceAlpha: 1
XData: [251×1 double]
YData: [81×1 double]
ZData: [81×251 double]
CData: [81×251 double]
Show all properties
>>
6 Kommentare
Fangjun Jiang
am 11 Aug. 2021
Bearbeitet: Fangjun Jiang
am 11 Aug. 2021
Where is the error message? Can you show the commands and error message when it happened?
The fact that X, Y and Z data show up means your quoted code has been executed successfully.
Siehe auch
Kategorien
Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!