From: Ulrik Nash on
Hi Everyone,

I it possible to reduce the following to a single line?

A = max([firm_profit(:,t),firm_price(:,t)])
B = A(1,1)

Kind regards,

Ulrik.
From: us on
"Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mov9$m1f$1(a)fred.mathworks.com>...
> Hi Everyone,
>
> I it possible to reduce the following to a single line?
>
> A = max([firm_profit(:,t),firm_price(:,t)])
> B = A(1,1)
>
> Kind regards,
>
> Ulrik.

yes, of course...

A=max([firm_profit(:,t),firm_price(:,t)]);B=A(1,1);

us
From: Ulrik Nash on
"us " <us(a)neurol.unizh.ch> wrote in message <i1mpg4$p36$1(a)fred.mathworks.com>...
> "Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mov9$m1f$1(a)fred.mathworks.com>...
> > Hi Everyone,
> >
> > I it possible to reduce the following to a single line?
> >
> > A = max([firm_profit(:,t),firm_price(:,t)])
> > B = A(1,1)
> >
> > Kind regards,
> >
> > Ulrik.
>
> yes, of course...
>
> A=max([firm_profit(:,t),firm_price(:,t)]);B=A(1,1);
>
> us

That is neat! Thanks us! :-)
From: Ulrik Nash on
"Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mprd$hqs$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message <i1mpg4$p36$1(a)fred.mathworks.com>...
> > "Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mov9$m1f$1(a)fred.mathworks.com>...
> > > Hi Everyone,
> > >
> > > I it possible to reduce the following to a single line?
> > >
> > > A = max([firm_profit(:,t),firm_price(:,t)])
> > > B = A(1,1)
> > >
> > > Kind regards,
> > >
> > > Ulrik.
> >
> > yes, of course...
> >
> > A=max([firm_profit(:,t),firm_price(:,t)]);B=A(1,1);
> >
> > us
>
> That is neat! Thanks us! :-)


Maybe I was a little fast there. Is it not possible to achieve the result with only one equation?
From: us on
"Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mq8h$e13$1(a)fred.mathworks.com>...
> "Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mprd$hqs$1(a)fred.mathworks.com>...
> > "us " <us(a)neurol.unizh.ch> wrote in message <i1mpg4$p36$1(a)fred.mathworks.com>...
> > > "Ulrik Nash" <uwn(a)sam.sdu.dk> wrote in message <i1mov9$m1f$1(a)fred.mathworks.com>...
> > > > Hi Everyone,
> > > >
> > > > I it possible to reduce the following to a single line?
> > > >
> > > > A = max([firm_profit(:,t),firm_price(:,t)])
> > > > B = A(1,1)
> > > >
> > > > Kind regards,
> > > >
> > > > Ulrik.
> > >
> > > yes, of course...
> > >
> > > A=max([firm_profit(:,t),firm_price(:,t)]);B=A(1,1);
> > >
> > > us
> >
> > That is neat! Thanks us! :-)
>
>
> Maybe I was a little fast there. Is it not possible to achieve the result with only one equation?

well... the first reply was a ...JOKE..., of course...

one of the solutions

[a,b]=deal(max(-1:2))
% a = 2
% b = 2

us