Re: return two different values
- To: mathgroup at smc.vnet.net
- Subject: [mg83882] Re: [mg83829] return two different values
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 3 Dec 2007 05:51:14 -0500 (EST)
- Reply-to: hanlonr at cox.net
My module doesn't do anything except return a number and a list. Substitute these fixed values with your calculations.
CalcMean[data_] := Module[{EMean, MeanImg},
EMean = 4;
MeanImg = {{1, 2}, {3, 4}};
{EMean, MeanImg}]; (*Dummy Module*)
{MeanX, RedMeanVec} = CalcMean[RedImg];
MeanX
4
RedMeanVec
{{1, 2}, {3, 4}}
Bob Hanlon
---- vicky Al Aisa <vickyisai at gmail.com> wrote:
> Hello all
>
> I am writing a module, from which i want to return 2 different values,
> one table and one just a normal int
>
> i used this syntax in module
>
> Return[EMean,MeanImg];
>
> and while receiving it in main program i use
>
> {MeanX,RedMeanVec}=CalcMean[RedImg];
>
>
> is this correct, because i am getting some error..which mean that the
> arguments are not matching.
> so i tried to define those arguments , like i defined RedmeanVec as a
> table, but still it doesn work
> Error is below
>
>
> Break::nofunc
> Continue::nofunc
> Return::nofunc
> function::nofunc: Function f not found enclosing expr.
>
> I use Mathematica 5.2
>
> Thnaks
>
>