MATLAB Answers

Tom
0

Not Enough Input Arguments

Asked by Tom
on 3 Aug 2019
Latest activity Commented on by Walter Roberson
on 7 Aug 2019
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.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Walter Roberson
on 4 Aug 2019

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 Comments

Please show the call to save_data_R13_MFS()
Also, which line is reporting the error about too many input arguments or not enough input arguments?
Tom
on 6 Aug 2019
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.
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.

Sign in to comment.