Unrecognized function or variable 'PolyLines_Shape'

1 view (last 30 days)
Omer Iqbal
Omer Iqbal on 26 Oct 2021
Answered: Shanmukha Voggu on 29 Oct 2021
I am running a code to make shapefiles in the matlab for fractures. I do have the variable "Polyline_shape" but I am still getting the error of 'unrecofnized variable'. As we get this error when we dont have the define variable in function to operate but I have the variable in upper lines of codes. Please see an attachment for your reference.
for k=1:length(C)
[PolyLines_Shape(k).Tile_ID] = i;
% [PolyLines_Shape(k).Ortho_ID] = PolyLines{i,2};
% [PolyLines_Shape(k).BoundingBox] = [R{PolyLines_Georeferenced_Rotated{i,2},1}.LongitudeLimits(1,1) ...
% R{PolyLines_Georeferenced_Rotated{i,2},1}.LatitudeLimits(1,1); ...
% R{PolyLines_Georeferenced_Rotated{i,2},1}.LongitudeLimits(1,2) ...
% R{PolyLines_Georeferenced_Rotated{i,2},1}.LatitudeLimits(1,2)];
[PolyLines_Shape(k).Geometry] = 'PolyLine';
[PolyLines_Shape(k).Polyline_ID] = k;
[PolyLines_Shape(k).Polyline_in_Ortho_ID] = z;
% if C is a cell array
%[PolyLines_Shape(k).X] = C{k-j+1,1}(:,1);
% if C is not a cell array
[PolyLines_Shape(k).X] = C{k,1}(:,1);
% if C is a cell array
%[PolyLines_Shape(k).Y] = C{k-j+1,1}(:,2);
%if C is not a cell array
[PolyLines_Shape(k).Y] = C{k,1}(:,2);
clearvars C PolyLines_Shape;
%% Writing shapefile

Answers (1)

Shanmukha Voggu
Shanmukha Voggu on 29 Oct 2021
Hi Omer,
Unrecognized function or variable 'PolyLines_Shape' error is due to unavailability of the variable PolyLines_Shape in the Workspace. I suspect this is due to usage of below statement in your code
clearvars C PolyLines_Shape;% Remove this statement before shapewrite function
Troubleshoot the issue further with the breakpoints. if the above step doesn't work .
Refer to this for more information.

Community Treasure Hunt

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

Start Hunting!