[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More MATLAB Silliness
From: |
Michael Creel |
Subject: |
Re: More MATLAB Silliness |
Date: |
Wed, 06 Oct 2004 09:24:51 +0200 |
User-agent: |
KMail/1.7 |
On Tuesday 05 October 2004 22:33, John W. Eaton wrote:
> On 29-Sep-2004, Quentin Spencer <address@hidden> wrote:
> | For anyone tracking weird things that MATLAB lets you do that somebody
> |
> | might ask for in octave someday, how about this:
> | >> a=ones(2,1);
> | >> b(1,:)=ones(2,1);
> | >> whos
> |
> | Name Size Bytes Class
> |
> | a 2x1 16 double array
> | b 1x2 16 double array
> |
> | I'm always unintentionally doing things like this in my code (assign a
> | column vector to a row of a matrix), and in the past both Octave and
> | MATLAB would give you an error, and I would fix it. Release 14 appears
> | to have changed this to automatically detect what you meant to do and
> | take care of it for you. A nice thought, I suppose, but I wonder what
> | unintended consequences this could cause for an unsuspecting user. Are
> | there any reasons other than convenience why this behavior is good? Any
> | guesses on how many releases until they remove this feature?
>
> I suspect that this behavior is allowed because the orientation of
> vectors is considered unimportant.
>
> Should we copy this behavior?
>
> The problem I see is that you can be tripped up if you are writing
> code that is expected to work with matrices but only test your code
> with matrices that have one row or column. Then it can appear that
> your code is OK during testing and fail later when someone tries to
> run the code with matrices that have rows and columns both greater
> than 1.
>
> jwe
IMHO, stuff like this, if used, makes for hard to understand and maintain
code. Another question is what this could be good for? But on the other hand,
I can appreciate the attractiveness of compatibility when it's possible. Does
Octave want to attract all Matlab users, or just the ones that program in an
intelligible way?
Michael