Not Enough Input Arguments

2 次查看(过去 30 天)
Tom
Tom 2019-8-3
I am attempting to run someone else's code (not well written, I appreciate), it begins as:
function save_data_R13_MFS(build_variables_R13)
close all
% load Soln_Kn_0.05_Na_10_bc_rad_1_sing_rad_0.2.mat
load(build_variables_R13.m)
N_alpha=N_phi;
sing_rad = sing_rad;
N_phi=N_phi;
N=N;
dg=dg;
The aim is to generate graphs of pressure and velocity using the Green's function for velocity from the build_variables_R13.m file, which starts as follows:
function [...
S11, S12, S13 ,...
S21, S22, S23 ,...
S31, S32, S33 ,...
m111, m112, m113,...
m121, m122, m123,...
m131, m132, m133,...
m211, m212, m213,...
m221, m222, m223,...
m231, m232, m233,...
m311, m312, m313,...
m321, m322, m323,...
m331, m332, m333,...
M1, M2, M3, p, v, q, theta,RGrad] = build_variables_R13
However, when I try to run the code it says that there is an issue with the line load(build_variables_R13.m) because there are not enough input arguments. Did anyone have any ideas or suggestions as why this would not be working? I could try and include more of the code, but it gets really messy after this point, I think I just need an idea of why this particular message might be appearing.

回答(1 个)

Walter Roberson
Walter Roberson 2019-8-4
That is a function. You do not load() it, you execute it and assign outputs to variables.
[Outs{1:44}] = build_variables_R13() ;
And then extract entries from the cell Outs.
I notice that immediately after the load() that variables are used that are not in the workspace and do not correspond to names that are output, such as N_phi. I worry that that might be an internal variable from the function that is not being returned.
I also notice that the name of the build function appears to be passed in to the save* function. How is that being passed? As a character vector that includes a .m extension? That includes a directory path? Handle to anonymous function?
  6 个评论
Tom
Tom 2019-8-6
编辑:Tom 2019-8-6
I'm not sure what you mean about the call to save_data_R13_MFS()
The file is called save_data_R13_MFS.m and it is basically trying to solve a problem with boundary conditions and then find variables like polar component of the velocity, temperature etc.
The fundamental solution for the velocity is in the file build_variables_R13.m which is being called in the file save_data_R13_MFS.m. I can't include the build_variables file as it is a mess, but it starts
function [...
S11, S12, S13 ,...
S21, S22, S23 ,...
S31, S32, S33 ,...
m111, m112, m113,...
m121, m122, m123,...
m131, m132, m133,...
m211, m212, m213,...
m221, m222, m223,...
m231, m232, m233,...
m311, m312, m313,...
m321, m322, m323,...
m331, m332, m333,...
M1, M2, M3, p, v, q, theta,RGrad] = build_variables_R13
p = @(x,y,z,DOF,Kn) (1/72).*exp(1).^((-1).*(5/6).^(1/2).*Kn.^(-1).*(x.^2+y.^2+z.^2).^(1/2)) ...
.*Kn.^(-1).*pi.^(-1).*(x.^2+y.^2+z.^2).^(-5/2).*(8.*y.^4.*DOF(1)+16.* ...
y.^2.*z.^2.*DOF
It's line 31 which says too many input arguments, where it goes to build_variables_R13.
Walter Roberson
Walter Roberson 2019-8-7
The file is called save_data_R13_MFS.m
At some point, you invoke save_data_R13_MFS, passing in something . We need to see the place that save_data_R13_MFS is called -- we need to see exactly what is being passed in.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by