Why do i get this error? "Unrecognized function or variable 'prop'."

My code uses another .m file named openprop.m but somehow i cant manage to get csv files and get this error. First code is openprop.m , the other one is exportsolidworks.m. when i run exportsolids code i get this error.
clear global; clear all; close all; clc;
disp('% ----------------------------------------------------------------------- %')
disp('% %')
disp('% 0111000 %')
disp('% 100 1 100 001 %')
disp('% 10 1 1 1 00 %')
disp('% 01 1 1 1 0 %')
disp('% 0 1 1 1 1 1 1 0 %')
disp('% 0 1 1 1 1 1 0 %')
disp('% 0 1 1 1 1 1 0 %')
disp('% 0 1 1 1 1 0 1 0 %')
disp('% 0 1 1 1 0 1 0 %')
disp('% 01 1 1 1 1 0 %')
disp('% 0 0 1 0 1 0 %')
disp('% 0 1 0 %')
disp('% 10010 0 1101111110111 %')
disp('% 10 1 1 1111111111 11 11 %')
disp('% 0 1 1 1 11111111101011010111 %')
disp('% 01 11 11111111 1 1 1 110 %')
disp('% 011 1 1 111111110011 1 1 1 110 %')
disp('% 0 11 1 1 1 111 0 1 1 1 10 %')
disp('% 0 1 11 1 0 1 1 1 1 1 1 0 %')
disp('% 1 11 1 1 11 0 1 1 1 1 11 %')
disp('% 0 1 1 0 011 1 1 1 10 %')
disp('% 10 1 1 0 0 1 1 1 11 %')
disp('% 10 01 01 10 %')
disp('% 10001 001 100 %')
disp('% 111 %')
disp('% %')
disp('% ____ _____ %')
disp('% / __ \ | __ \ %')
disp('% | | | |_ __ ___ _ __ | |__) | __ ___ _ __ %')
disp('% | | | | ''_ \ / _ \ ''_ \| ___/ ''__/ _ \| ''_ \ %')
disp('% | |__| | |_) | __/ | | | | | | | (_) | |_) | %')
disp('% \____/| .__/ \___|_| |_|_| |_| \___/| .__/ %')
disp('% | | | | %')
disp('% |_| |_| %')
disp('% %')
disp('% An integrated rotor design and analysis tool. %')
disp('% %')
disp('% %')
disp('% Copyright (C) 2011, Brenden Epps. %')
disp('% %')
disp('% This program is free software; you can redistribute it and/or modify it %')
disp('% under the terms of the GNU General Public License as published by the %')
disp('% Free Software Foundation. %')
disp('% %')
disp('% This program is distributed in the hope that it will be useful, but %')
disp('% WITHOUT ANY WARRANTY; without even the implied warranty of %')
disp('% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. %')
disp('% See the GNU General Public Licens e for more details. %')
disp('% %')
disp('% ----------------------------------------------------------------------- %')
addpath SourceCode
run('SourceCode/OpenPropSingle.m')
% -------------------------------------------------------------------------
% Created: Brenden Epps, 8/12/10
%
% Make SolidWorks.txt files, with coordinates for a single blade.
%
% Use this with SolidWorks macro v18.
%
% Blade geometry:
% X3D(i,j,k) [m], X position in 3D space
% Y2D(i,j,k) [m], Y position in 3D space
% Z3D(i,j,k) [m], Z position in 3D space
%
% i = 1:Mp+1 % for each section along the span
% j = 1:2*Np % for each point along the upper and lower surfaces
% k = 1:Z % for each blade
%
% -------------------------------------------------------------------------
function [] = Export_SolidWorks_v18(filename_SolidWorks,Np,Mp,Z,X3D,Y3D,Z3D)
filename_length = size(filename_SolidWorks,2);
foldername = filename_SolidWorks(1:filename_length-4);
mkdir(foldername);
cd(foldername);
%fid = fopen(filename_SolidWorks,'wt');
%section curves
for k = 1:Mp
filename_SolidWorks_improved = strcat('SectionCurve',sprintf('%04d', k),'.csv');
fid = fopen(filename_SolidWorks_improved,'wt');
for j = [1:Np,Np+2:2*Np-1,1] % (2*Np-1 points) does not double print the leading edge
fprintf(fid,'%f,%f,%f,\n',X3D(k,j,1)*1,Y3D(k,j,1)*1,Z3D(k,1,1)*1); %Y neg ==> counterclockwise rotation
end
% k = 1;
% j = 1;
% fprintf(fid,'%f,%f,%f \n',X3D(k,j,1)*39.3700787,Y3D(k,j,1)*39.3700787,Z3D(k,1,1)*39.3700787);
%
fclose(fid);
end
cd ../
%
% %guide curves
% n = 0;
% for j = [1 floor(Np/3) floor(2*Np/3) Np floor(4*Np/3) floor(5*Np/3) 2*Np-1];
% n = n + 1;
% for i = 1:Mp+1 % for each section along the span
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
% end
%
%
% j = 1;
% for i = 1:Mp+1 % for each section along the span
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
% j = 2*Np;
% for i = 1:Mp+1 % for each section along the span
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
%
%
%
%
%
%
% i = Mp+1;
% for j = [1:Np,Np+2:2*Np-1,1] % (2*Np-1 points) does not double print the leading edge
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
% % Output tip curves
% for j = 1:Np-2
% i=Mp+1;
% fprintf(fid,'%f,%f,%f,\n',X3D(i, 1+j,1),Y3D(i, 1+j,1),Z3D(i, 1+j,1));
% fprintf(fid,'%f,%f,%f,\n',X3D(i,2*Np-j,1),Y3D(i,2*Np-j,1),Z3D(i,2*Np-j,1));
% end
%
%
% % Output duplicate root section profile:
% i = 1;
%
% % for each point along the suction and pressure surfaces
% % (trailing edge -> leading edge -> trailing edge)
% for j = [1:Np,Np+2:2*Np-1,1] % (2*Np-1 points) does not double print the leading edge
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
%
% % Output root curves
% for j = 1:Np-2
%
% i=1;
% fprintf(fid,'%f,%f,%f,\n',X3D(i, 1+j,1),Y3D(i, 1+j,1),Z3D(i, 1+j,1));
% fprintf(fid,'%f,%f,%f,\n',X3D(i,2*Np-j,1),Y3D(i,2*Np-j,1),Z3D(i,2*Np-j,1));
% end
%
%
% % Output trailing edge curves for each 2D section along the span
% for i = 1:Mp+1
% j=1;
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% j=2*Np;
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%fclose(fid);
% fid = fopen(filename_SolidWorks,'wt'); % 1-Aug-2013 BEPPS: 'w' changed to 'wt' so newline character '\n' appears properly on Windows machines
%
% % Prop Parameters at beginning of file
% fprintf(fid,'%g, ' ,Np);
% fprintf(fid,'%g, ' ,Mp);
% fprintf(fid,'%g,\n',Z);
%
% % Output curves defining each 2D section along the span
% % for each section along the span
% for i = 1:Mp+1
% fprintf(fid,'SectionCurve%g, \n',i);
%
% % for each point along the suction and pressure surfaces
% % (trailing edge -> leading edge -> trailing edge, close the curve)
% for j = [1:Np,Np+2:2*Np-1,1] % (2*Np-1 points) does not double print the leading edge
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
% end
%
%
% % Make guide curves
% n = 0;
% % for 7 points along the chord
% for j = [1 floor(Np/3) floor(2*Np/3) Np floor(4*Np/3) floor(5*Np/3) 2*Np-1];
% n = n + 1;
%
% fprintf(fid,'GuideCurve%g, \n',n);
% for i = 1:Mp+1 % for each section along the span
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
% end
%
% % % Output duplicate trailing edge guide curves:
% % % Guide curve 1:
% % fprintf(fid,'TEGuideCurve1,\n');
% % j = 1;
% % for i = 1:Mp+1 % for each section along the span
% % fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% % end
% %
% % % Guide curve 7:
% % fprintf(fid,'TEGuideCurve7,\n');
% % j = 2*Np;
% % for i = 1:Mp+1 % for each section along the span
% % fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% % end
%
%
% % Output duplicate tip section profile:
% i = Mp+1;
% fprintf(fid,'TipSectionCurve%g, \n',i);
% for j = [1:Np,Np+2:2*Np-1,1] % (2*Np-1 points) does not double print the leading edge
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
% % Output tip curves
% for j = 1:Np-2
% fprintf(fid,'TipCurve%g, \n',j);
% i=Mp+1;
% fprintf(fid,'%f,%f,%f,\n',X3D(i, 1+j,1),Y3D(i, 1+j,1),Z3D(i, 1+j,1));
% fprintf(fid,'%f,%f,%f,\n',X3D(i,2*Np-j,1),Y3D(i,2*Np-j,1),Z3D(i,2*Np-j,1));
% end
%
%
% % Output duplicate root section profile:
% i = 1;
% fprintf(fid,'RootSectionCurve%g, \n',i);
% % for each point along the suction and pressure surfaces
% % (trailing edge -> leading edge -> trailing edge)
% for j = [1:Np,Np+2:2*Np-1,1] % (2*Np-1 points) does not double print the leading edge
% fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% end
%
%
% % Output root curves
% for j = 1:Np-2
% fprintf(fid,'RootCurve%g, \n',j);
% i=1;
% fprintf(fid,'%f,%f,%f,\n',X3D(i, 1+j,1),Y3D(i, 1+j,1),Z3D(i, 1+j,1));
% fprintf(fid,'%f,%f,%f,\n',X3D(i,2*Np-j,1),Y3D(i,2*Np-j,1),Z3D(i,2*Np-j,1));
% end
%
%
% % % Output trailing edge curves for each 2D section along the span
% % for i = 1:Mp+1
% % fprintf(fid,strcat('TECurve',num2str(i),',\n'));
% % j=1;
% % fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% % j=2*Np;
% % fprintf(fid,'%f,%f,%f,\n',X3D(i,j,1),Y3D(i,j,1),Z3D(i,j,1));
% % end
%
%fclose(fid);
end % function

2 个评论

I don't see, in the code you provided, anywhere where a variable called props is references. Please attach the m-files with the paperclip icon. Also give the full error message (ALL THE RED TEXT) which will give the line number and actual line of code that threw the error.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Full error is below:
>> Export_SolidWorks_v18(prop)
Unrecognized function or variable 'prop'.
Problem is this code gives csv files as an output when i insert inputs but i think i missed something so it gaves error.

请先登录,再进行评论。

 采纳的回答

You are trying to invoke Export_SolidWorks_v18 passing in the single undefined parameter prop .
prop is undefined. There is no variable named prop created by openprop or OpenPropSingle.
Furthermore, Export_SolidWorks_v18 needs several parameters passed to it, Export_SolidWorks_v18(filename_SolidWorks,Np,Mp,Z,X3D,Y3D,Z3D) and you are just not passing those parameters.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Function Creation 的更多信息

产品

版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by