f



output argument "what ever"is not assigned

Hi,

I have a little matlab problem. When I try to run my function I get
following error:

output argument "gridLd" is not assigned

Does anyone sees the error?

May function-codes is:

function [cycleLd, cycleRd, cycleDk, cycleSoi, cycleMpi,
cycleAgr]=ecu(cycleRpm, cycleTorque, rpm, torque, ldGrid, rdGrid,
dkGrid, soiGrid, mpiGrid, agrGrid)

lengthTorque=length(torque);
lengthRpm=length(rpm);

cycleLd = zeros(1,length(cycleLength));
cycleRd = cycleLd;
cycleDk = cycleLd;
cycleSoi = cycleLd;
cycleMpi = cycleLd;
cycleAgr = cycleLd;

for i = 1:cycleLength
    [iRpm,vRpm]=searchclosest(rpm, cycleRpm);
    [iTorque,vTorque]=searchclosest(torque, cycleTorque);
    cycleLd(i)=ldGrid(iRpm,iTorque);
    cycleRd(i)=rdGrid(iRpm,iTorque);
    cycleDk(i)=dkGrid(iRpm,iTorque);
    cycleSoi(i)=soiGrid(iRpm,iTorque);
    cycleMpi(i)=mpiGrid(iRpm,iTorque);
    cycleAgr(i)=agrGrid(iRpm,iTorque);
end;

end
0
1/24/2011 2:44:51 PM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

6 Replies
1731 Views

Similar Articles

[PageSpeed] 39

Sebastian Preis wrote:
> Hi,
> 
> I have a little matlab problem. When I try to run my function I get
> following error:
> 
> output argument "gridLd" is not assigned
> 
> Does anyone sees the error?
> 
> May function-codes is:
> 
> function [cycleLd, cycleRd, cycleDk, cycleSoi, cycleMpi,
> cycleAgr]=ecu(cycleRpm, cycleTorque, rpm, torque, ldGrid, rdGrid,
> dkGrid, soiGrid, mpiGrid, agrGrid)
> 
....

Crystal ball is a little murky this AM (flurries later predicted so 
guess it's not surprising) but...

Fuzzy image #1 says maybe you're executing a cached version of the 
function; try

clear ecu

Fuzzy image #2 looks like the problem isn't in the code snippet posted...

--
0
dpb
1/24/2011 2:52:56 PM
Are you sure you didn't mean "cycleLd" instead?  At least *that* is
*in* the output arg list.  But even that doesn't make sense because
you did this:
cycleLd = zeros(1,length(cycleLength));
and cycleLength is not defined, so it should have thrown a different
exception.  Please paste the exact code and the exact error message
rather than trying to paraphrase it while transcibing it.
0
ImageAnalyst
1/24/2011 2:58:22 PM
Sebastian Preis <sebastianpreis@googlemail.com> wrote in message <325cd66a-1f1f-41bb-a48b-f5bf16d9acf9@v17g2000vbo.googlegroups.com>...
> Hi,
> 
> I have a little matlab problem. When I try to run my function I get
> following error:
> 
> output argument "gridLd" is not assigned
> 
> Does anyone sees the error?
> 
> May function-codes is:
> 
> function [cycleLd, cycleRd, cycleDk, cycleSoi, cycleMpi,
> cycleAgr]=ecu(cycleRpm, cycleTorque, rpm, torque, ldGrid, rdGrid,
> dkGrid, soiGrid, mpiGrid, agrGrid)
> 
> lengthTorque=length(torque);
> lengthRpm=length(rpm);
> 
> cycleLd = zeros(1,length(cycleLength));
> cycleRd = cycleLd;
> cycleDk = cycleLd;
> cycleSoi = cycleLd;
> cycleMpi = cycleLd;
> cycleAgr = cycleLd;
> 
> for i = 1:cycleLength
>     [iRpm,vRpm]=searchclosest(rpm, cycleRpm);
>     [iTorque,vTorque]=searchclosest(torque, cycleTorque);
>     cycleLd(i)=ldGrid(iRpm,iTorque);
>     cycleRd(i)=rdGrid(iRpm,iTorque);
>     cycleDk(i)=dkGrid(iRpm,iTorque);
>     cycleSoi(i)=soiGrid(iRpm,iTorque);
>     cycleMpi(i)=mpiGrid(iRpm,iTorque);
>     cycleAgr(i)=agrGrid(iRpm,iTorque);
> end;
> 
> end
Hi,
There are some coding errors.
>> cycleLd = zeros(1,length(cycleLength));
cycleLength is not passed to the function.
You should pass is explicitly or if it has some value assign that value inside the function.
There is no such output argument  "gridLd" in your code. 

HTH
Saif
0
user
1/24/2011 3:00:04 PM

"Sebastian Preis" <sebastianpreis@googlemail.com> wrote in message 
news:325cd66a-1f1f-41bb-a48b-f5bf16d9acf9@v17g2000vbo.googlegroups.com...
> Hi,
>
> I have a little matlab problem. When I try to run my function I get
> following error:
>
> output argument "gridLd" is not assigned
>
> Does anyone sees the error?
>
> May function-codes is:
>
> function [cycleLd, cycleRd, cycleDk, cycleSoi, cycleMpi,
> cycleAgr]=ecu(cycleRpm, cycleTorque, rpm, torque, ldGrid, rdGrid,
> dkGrid, soiGrid, mpiGrid, agrGrid)

Since gridLd is not one of the output arguments specified on the function 
declaration line of ecu, I suspect the problem occurs in your searchclosest 
function.  However, since you haven't posted that code I don't think there's 
anything anyone (other than you) can do to determine the cause of this 
problem.  It likely has a code path that does not define one or more of the 
output arguments -- you need to determine what that code path is and what 
the correct value for that output argument should be when that code path is 
executed.

*snip*

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
Steven_Lord
1/24/2011 3:03:59 PM
I=B4m sorry. Please ignore the >>cycleLd =3D zeros(1,length(cycleLength));
ERROR
The message was about all the output values
[cycleLd, cycleRd, cycleDk, cycleSoi, cycleMpi,cycleAgr]
0
Sebastian
1/24/2011 3:11:52 PM
Sebastian Preis wrote:
> I�m sorry. Please ignore the >>cycleLd = zeros(1,length(cycleLength));
> ERROR
> The message was about all the output values
> [cycleLd, cycleRd, cycleDk, cycleSoi, cycleMpi,cycleAgr]

Again, as noted, unless you post _exact_ message and code it's unlikely 
to get any further help than the advice already given.

--
0
dpb
1/24/2011 3:23:55 PM
Reply: