Not Enough input Arguments Plotting

hey all...I manually made a contour plot using bxx,byy,Mean_Pk_Stat variables that were calculated in a program. Looks great, has titles, etc. Then I generate code for the plot and have the Average_PkPress.m plot code in my folder. I write in my main program, for example
Average_PkPress (bxx,byy,Mean_Pk_Stat);
I run the same program, generate the same data and get the 'not enough input arguments' error, and a blank plot appears. I can still manually make a plot with the same (x,y,z) data after the program stalls. Is Matlab having troubles finding the data? I have never seen this before, but I am still a neophyte.
Any thoughts? Thanks in advance

4 个评论

It means exactly what it says. You don't have input arguments required by your function. Since we don't have access to your folder to see this m file, it's hard for us to tell you more. It's better if you also add that code snippet to your question.
%Load Normalized
Meas_ynorm=byy/maxload;
save workspace
input('Mean Peak Pressure Colormap-Enter');
Average_PkPress (bxx,byy,Mean_Pk_Stat);
input ('Maximum Peak Pressure Colormap - Enter');
Max_PkPress (bxx,byy,Max_Pk_Stat);
input('Mean dP/Dtheta colormap -Enter');
Average_DPDTHeta (bxx,byy,Mean_DP_Stat);
input('Mean dP/Dtheta colormap -Enter');
Max_DPDTHeta (bxx,byy,Max_DP_Stat);
Thanks for your interest. Here's the snip. Also the data is in workspace: bxx (64x64), byy (64x64), Mean_Pk_Stat (64x64). The issue is the program does not seem to look for these workspace variables. But I can select them manually from the workspace and make my desired plot. Almost like the program is looking into the workspace before it is told to exist, but really the plot routines are at the very end of the script. Is it possible it s looking in a different directory for the workspace variables? Yep- never saw this happen before. Thanks!
Here is where Average_PkPress fails @ line 23 shown in BOLD. Again the plot .m file was generated by Matlab after making a plot I found I like using the workspace variables generated by the program used to calculate the functions. Is matlab generating bogus plot files?
% Create axes axes1 = axes('Parent',figure1); %% Uncomment the following line to preserve the X-limits of the axes % xlim(axes1,[722.763718569018 1938.94963555058]); %% Uncomment the following line to preserve the Y-limits of the axes % ylim(axes1,[-65.063343752351 220.388226259681]); box(axes1,'on'); hold(axes1,'all');
% * * Create surface surface ('Parent',axes1,'ZData',ZData1,'YData',YData1,'XData',XData1,... 'CData',CData1);* * % Create xlabel xlabel('Engine Speed (RPM)');
% Create ylabel ylabel('Engine Load (N-m)');
% Create title title('Average Peak Pressure In Each Bin');
% Create colorbar colorbar('peer',axes1);

请先登录,再进行评论。

回答(1 个)

You need to accept the user's response into a variable and you aren't doing that, so do it like this:
meanPeakPressure = input('Mean Peak Pressure Colormap-Enter');
Average_PkPress (bxx,byy,Mean_Pk_Stat);
maxPeakPressure = input ('Maximum Peak Pressure Colormap - Enter');
Max_PkPress (bxx,byy,Max_Pk_Stat);
meandP = input('Mean dP/Dtheta colormap -Enter');
Average_DPDTHeta (bxx,byy,Mean_DP_Stat);
meandP = input('Mean dP/Dtheta colormap -Enter');
Max_DPDTHeta (bxx,byy,Max_DP_Stat);
Whether you're passing in all the variables that function Average_PkPress() needs, we don't know, because you didn't give the function definition of Average_PkPress.
You have to make sure you're collecting the user input into the correctly named variables and pass all the variables into a function that the function needs.

1 个评论

Here is where Average_PkPress fails @ line 23 shown in BOLD. Again the plot .m file was generated by Matlab after making a plot I found I like using the workspace variables generated by the program used to calculate the functions. Is matlab generating bogus plot files?
% Create axes axes1 = axes('Parent',figure1); %% Uncomment the following line to preserve the X-limits of the axes % xlim(axes1,[722.763718569018 1938.94963555058]); %% Uncomment the following line to preserve the Y-limits of the axes % ylim(axes1,[-65.063343752351 220.388226259681]); box(axes1,'on'); hold(axes1,'all');
% * * Create surface surface('Parent',axes1,'ZData',ZData1,'YData',YData1,'XData',XData1,... 'CData',CData1);**
% Create xlabel xlabel('Engine Speed (RPM)');
% Create ylabel ylabel('Engine Load (N-m)');
% Create title title('Average Peak Pressure In Each Bin');
% Create colorbar colorbar('peer',axes1);

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Geographic Plots 的更多信息

提问:

2017-5-5

评论:

2017-5-5

Community Treasure Hunt

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

Start Hunting!

Translated by