Unrecognized function or variable 'PolyLines_Shape'
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!