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 ]
dpb

Posts: 8,115
Registered: 6/7/07
Re: Matrix dimensions must agree.
Posted: Mar 20, 2014 2:08 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 3/20/2014 12:57 PM, Vitor Andrade wrote:
...

> I don't understand you. I would like to delete the row that is left
> over. Is there anyway? I want to implement this on my code.


Which specific row is the "leftover" one? First, last, some other based
on some value...?

But, sure...that's one of the ways to implement option B --

Assume two arrays are x and y and it's the last row to eliminate in the
longer array...

lenx=length(x);
leny=length(y);
if lenx>leny
x(leny+1:end)=[];
elseif
if leny>lenx
y(lenx+1:end)=[];
end

It might be simpler to prevent the two arrays from being different
length to begin with but that depends on how they're created.

--







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.