Unrecognized function or variable 'PolyLines_Shape'
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
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
0 Comments
See Also
Categories
Find more on Coordinate Transformations and Trajectories 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!