Azzera filtri
Azzera filtri

Error in UIControl Callback with unrecognised variable

3 visualizzazioni (ultimi 30 giorni)
Hi, the error message I keep getting is Error using UIadjusted>borient_callback
Connectivity list refers to a point index that exceeds the number of points in coord.
'coord' is not being recognised as a variable which may be the issue. It is defined in an external function which is called on in the main script (UIadjusted) but maybe there is a problem with it being passed between the scripts. I don't know how to correct or visualise the problem. I don't have a ton of coding experience so any help or suggestions are welcome!
  3 Commenti
Erin
Erin il 8 Ago 2023
UIadjusted is the main script. I think the error is specifically from line 228. dp_lr_orientation is one of the functions called on through PCOrientation which is the main orientation function however, coord is first defined in dp_lr_orientation.
Voss
Voss il 8 Ago 2023
Modificato: Voss il 8 Ago 2023
Here are lines 421-423 in UIadjusted.m, which are inside the function borient_callback. Line 422 is the line that throws the error (because that's what line 422 is intended for).
if max(ConL(:)) > size(coord, 1)
error('Connectivity list refers to a point index that exceeds the number of points in coord.');
end
As you can see, the error happens when max(ConL(:)) > size(coord, 1) and has nothing to do with coord not being recognized.
"[coord] is defined in an external function"
It is true that a variable called coord is calculated in the function dp_lr_orientation, here (lines 84-87):
xcoord = origin(ptc.Location(:,1)); %extracts coordinates from new point cloud and stores
ycoord = origin(ptc.Location(:,2)); %coordinate arrays and matrix
zcoord = origin(ptc.Location(:,3));
coord=[xcoord,ycoord,zcoord];
However, that variable coord is not the same as the variable coord in the function borient_callback, and in fact the variable coord in dp_lr_orientation is entirely unused. (You might notice an orange squiggly underline underneath coord in the editor and when you hover over it a message appears that says "The value assigned to the variable 'coord' might be unused.")
The variable coord in borient_callback is calculated from the xcoord, ycoord, and zcoord that are returned from the function PCOrientation, here (lines 385-386 of UIadjusted.m):
[xcoord,ycoord,zcoord,ptc,De,Pe,siding,scatterRatio]=PCOrientation(oc); %calls on PCOrientation to orientate the model correctly
coord=[xcoord,ycoord,zcoord]; %creates coordinate array from seperate coordinates from the point cloud
Maybe the variables xcoord, ycoord, and zcoord returned from PCOrientation are the same as the ones returned from dp_lr_orientation - I don't know because I don't have PCOrientation. Without all the necessary functions and data, no one but you can run the code.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Text Analytics Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by