-2

I have a custom function I have made, which requires two input arguments. This is the opening line of the function, clearly showing it needs just two input arugments:

function [file,frame,vertices,edges,faces,faceOrders,edgeOrders] = FOLD_reader(filename,rundocfolder) 

The FOLD_reader function is called within another function (FEAfromFOLDVaryingStiffness), using the following line of code:

[~,frame,vertices,~,faces,~,~] = FOLD_reader(filename,rundocfolder);

To which matlab claims:

Not enough input arguments.

Error in FEAfromFOLDVaryingStiffness (line 12)
[~,frame,vertices,~,faces,~,~] = FOLD_reader(filename,rundocfolder);"

However, if I copy and paste the offending line into the command window, it works perfectly. The filename and rundocfolder variables are definitely defined in FEAFromFoldVaryingStiffness which calls FOLD_reader, as they are among the input arguments of the FEAFromFold(etc) function itself.

Has anyone had any experience with this seemingly bizzarre error? To me it makes no sense at all.

If it's a help here are the lines up to the error point inside FEAfromFOLDVaryingStiffness:

function [] = FEAfromFOLDVaryingStiffness(filename,meshsize,displacement,m,n,stiffnessvary,rundocfolder)
%Comments ommitted for brevity
[~,frame,vertices,~,faces,~,~] = FOLD_reader(filename,rundocfolder);
  • 1
    The only thing I can think of is that you have a different version of this function declared somewhere else, in particular inside the file you are calling from. – Euan Smith Nov 14 '19 at 09:42
  • @EuanSmith is right. My recommendation would be to set a breakpoint prior to the line, then use the debugger to step into. You will see where you end up, probably not where you expect. – Daniel Nov 14 '19 at 09:46
  • I'm an idiot, I called the FEAfromFOLDVaryingStiffness with one too few arguments, I'd left out m or n or something and so the last input variable (rundocfolder) was undefined, which showed up as an error with fold_reader inside the FEAfromFOLDVaryingStiffness function, instead of where the error actually was: the top level script. – Edward Etheridge Nov 14 '19 at 09:47

1 Answers1

0

I'm an idiot, I called the FEAfromFOLDVaryingStiffness with one too few arguments, I'd left out m or n or something and so the last input variable (rundocfolder) was undefined, which showed up as an error with fold_reader inside the FEAfromFOLDVaryingStiffness function, instead of where the error actually was: the top level script.