Unrecognized function or variable 'PolyLines_Shape'

조회 수: 8 (최근 30일)
Omer Iqbal
Omer Iqbal 2021년 10월 26일
답변: Shanmukha Voggu 2021년 10월 29일
Hi!
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);
z=z+1;
end
j=length(PolyLines_Shape)+1;
shapewrite(PolyLines_Shape,strcat(outfolder,outfilename));
disp(i)
clearvars C PolyLines_Shape;
toc
end
%% Writing shapefile
tic
%shapewrite(PolyLines_Shape,'D:\PhD\Automatic_Detection\Core_Fractures\Shape_Files\xz769_Rotated_Simplified.shp');
shapewrite(PolyLines_Shape,"C:\Users\Omer\Documents\MATLAB\Automatic-Fracture-Detection-Code-1.0.0\Shape_Files");
toc

답변 (1개)

Shanmukha Voggu
Shanmukha Voggu 2021년 10월 29일
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.

카테고리

Help CenterFile Exchange에서 Octave에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by