Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Matrix dimensions must agree.
Replies: 13   Last Post: Mar 24, 2014 5:34 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Vitor Andrade

Posts: 12
Registered: 3/18/14
Re: Matrix dimensions must agree.
Posted: Mar 21, 2014 1:07 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

dpb <none@non.net> wrote in message <lghmho$g68$1@speranza.aioe.org>...
> On 3/21/2014 8:46 AM, Steven Lord wrote:
> > "Vitor Andrade" <vitor.luiz.de.andrade@gmail.com> wrote in message
> > news:lghenc$13g$1@newscl01ah.mathworks.com...

> ...
> >>> dpb <none@non.net> wrote in message <lgfaqk$820$1@speranza.aioe.org>...
> >>> > On 3/20/2014 12:57 PM, Vitor Andrade wrote:
> >
> ...
>

> >>>> if x > y
> a(y+1:end,:)=[];
> ...

> >> elseif y > x
> b(x+1:end,:)=[];
> end
> ...
>

> >
> > I wouldn't use this approach; I'd instead select the elements to keep.
> > It avoids the IF and ELSEIF statements at the expense of a call to MIN:
> >
> > minRows = min(x, y);
> > a = a(1:minRows, :);
> > b = b(1:minRows, :);
> >

> ...
>
> It then also has the cost of the selection on both where one is already
> ok that the if...elseif avoids which is why I went that route.
>
> My _real_ suggestion/hope was that Vitor would rethink his generation
> process and avoid the problem at the start instead of having to fix it
> up afterwards.
>
> I also wrote the example for vectors illustrating the idea (hence
> length() and linear addressing) but I suppose expecting the
> extrapolation to an array was too much of leap of faith for the neophyte :)
>
> --


Sorry Sir, I am a new programmer, I have total control over the MATLAB and its functions yet, however, I really appreciate your willingness to help me!
I'll rethink the medium in which I perform my questions in order to be more clear, direct and simple.

Since now I thank your attention given!

Sincerely.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.