# Not enough input arguments

6 views (last 30 days)
Hannah Cunningham on 9 Aug 2022
Answered: Matt J on 9 Aug 2022
I am trying to run this code but I keep getting the "Not enough Input arguments" on the line with "loglog(grainsize, stress(i,:),'color',cc(i,:))", which does not make sense to me because grainsize and stress are both 1x6 double. I have tried it with the color linspec removed and it gives the same error.
Help is appreciated.
CTemp=650; %<-- INPUT temperature in Celcius
KTemp=CTemp+273; %conversion to Kelvin
Bdepth=(CTemp/30)*1000; %<-- INPUT burial depth in meters, related to temperature
R=8.314; %gas constant
%Matrix values
strainrate=[1e-5 1e-7 1e-9 1e-11 1e-13 1e-15]; %range of strain rate values
grainsize=[0.01 0.1 1 10 100 1000]; %range of grain size in microns
% l = length(strainrate);
% stress = zeros(l,l);
cc=hsv(12); %generates a set of colors
%Diffusion Creep - Walker et al., 1990
for i=1:length(strainrate)
for j=1:length(grainsize)
A=10^4.93;
m=-1.87;
Q=190000;
n=1.7;
temp(i,j)=(strainrate(i)/(A*(grainsize(j).^m)*(exp(-Q/(R*KTemp)))))^(1/n);
stress(i,j) =[temp(i,j)];
end
loglog(grainsize, stress(i,:),'color',cc(i,:))
hold on
end
The full error I get is:
Not enough input arguments.
Error in isgraphics (line 3)
out = ishandle(h) && strcmpi(get(h,'type'),type);
Error in cla (line 45)
elseif isscalar(ax) && isgraphics(ax)
Error in newplot>ObserveAxesNextPlot (line 156)
cla(ax, 'reset', hsave);
Error in newplot (line 99)
ax = ObserveAxesNextPlot(ax, hsave);
Error in matlab.graphics.internal.newplotwrapper (line 11)
axReturn = newplot(varargin{:});
Error in CalciteDefMecMAP (line 45)
loglog(grainsize, stress(i,:),'color',cc(i,:))

Matt J on 9 Aug 2022
It must be something in your environment. Running the code here in the forum produces no errors. I would suggest clearing the workspace.
CTemp=650; %<-- INPUT temperature in Celcius
KTemp=CTemp+273; %conversion to Kelvin
Bdepth=(CTemp/30)*1000; %<-- INPUT burial depth in meters, related to temperature
R=8.314; %gas constant
%Matrix values
strainrate=[1e-5 1e-7 1e-9 1e-11 1e-13 1e-15]; %range of strain rate values
grainsize=[0.01 0.1 1 10 100 1000]; %range of grain size in microns
% l = length(strainrate);
% stress = zeros(l,l);
cc=hsv(12); %generates a set of colors
%Diffusion Creep - Walker et al., 1990
for i=1:length(strainrate)
for j=1:length(grainsize)
A=10^4.93;
m=-1.87;
Q=190000;
n=1.7;
temp(i,j)=(strainrate(i)/(A*(grainsize(j).^m)*(exp(-Q/(R*KTemp)))))^(1/n);
stress(i,j) =[temp(i,j)];
end
loglog(grainsize, stress(i,:),'color',cc(i,:))
hold on
end 