dpb
Posts:
6,677
Registered:
6/7/07
|
|
Re: Making a square matrix from two vector
Posted:
Feb 13, 2013 10:22 AM
|
|
On 2/13/2013 1:08 AM, Bruno Luong wrote: ...
> If one wants to develop a function that accept any kind of numerical > data, the behavior should be defined. So it is legitimate to speak how > colon behave when feed in complex data. That's how a specification of a > function is defined and developed. This is the basic concept of software > development.
That's again my observation there is no definitive language reference for Matlab--only a more or less complete narrative description.
> Now if user can't make head or tail with the behavior of such and such > function, that's his problem.
Well, that's a problem when the behavior doesn't follow the description but if there is no description it seems rather rude to blame that on the user. :)
> Recently I use the fact that ([]:1) return an empty set, therefore allow > me to save 1 test in my implementation. Is it meaningless?
Would all depend on context. Again, you bring in unrelated issues--the question specifically was on what colon() would mean for complex input when the two parts are separated by a different sign in the change between their values--so that the implicit default unit step for reals doesn't supply enough information to have a meaning.
One could, of course, define another set of defaults for the case, but the parser already warns that the use of complex isn't legal so it's hard to argue for anything but it being user error at the moment.
What any other case is for another particular piece of the language is immaterial to this one.
--
|
|