MATLAB: Function call doesn’t work in script, works in command window

MATLAB and Simulink Student Suitescript failure but command line successtoo many output arguments

I have a function that calls a sub-function within the same file: in main.m:
function main()
...
[a,b,c,d,e,f,g,h]=TimeCalculations(x1,x2,x3,x4,x5,x6);
...
end
function [a,b,c,d,e,f,g,h]=TimeCalculations(x1,x2,x3,x4,x5,x6)
... %calculations for a,b,c,d,e,f,g,h
end
When I run main(), the program errors on the call to TimeCalculations(). The error output is: too many output arguments. However, when I put a breakpoint at this line and then copy the line directly into the command window, I do not receive and error. Has anyone run into a similar scenario and how did they fix it?

Best Answer

I appreciate the feedback. We tracked down the problem. It's odd. In my psuedocode above, x5 is actually a variable called "info." It's a structure that is imported from another file. When calling TimeCalculations(....,info,...) in the script, Matlab must do something, I'm not sure what, but it doesn't pass the data structure "info" in. Instead, it calls the Matlab built-in function, info(). However, when I copy and paste the code into the command window, Matlab passes in the correct structure. Interestingly, I also couldn't assign the info structure to another variable and try to pass that in; that also resulted in an error. In the end, the only solution I found was to execute the code as follows:
eval('NewInfo=info');
clear info
[...]=TimeCalculations(....,NewInfo,...);
Now it works. Why I had to go this route, I don't understand. If anyone knows why Matlab evaluates the line differently depending on if it's in the m-file or the command window, I'd like to know.
THANKS!