From: james bejon on
Very nice, Oleg. Silly solutions are a lot more fun.
From: dpb on
Oleg Komarov wrote:
....

>> But if you have logical() at your disposal, then you could use
>>
>> o(x) = logical(1);
>>
....

Indeedy, do...very good (and why didn't _I_ think of it??? :( )... :)

--
From: dpb on
Matt Fig wrote:
> dpb <none(a)non.net> wrote in message
> <hotrs9$qbg$1(a)news.eternal-september.org>...
>> Nathan wrote:
>> ...
>>
>> > If you were going to do that, why not just make it logical in the
>> > first place?
>> > > o(x) = true;
>>
>> Primarily because...
>>
>> >> which true
>> true not found.
>> >> help true
>>
>> true.m not found.
>>
>> >>
>>
>> :(
>>
>> --
>
>
> Of course, you could fix that!
>
> function T = true(N)
> % Hacky-TRUE
> T = ~zeros(N);

true(aye-that);

--
From: dpb on
Walter Roberson wrote:
> dpb wrote:
>> james bejon wrote:
>>> Dear All, Is there a neat way of getting from, say,
>>>
>>> [3, 5, 8]
>>>
>>> to
>>>
>>> [0, 0, 1, 0, 1, 0, 0, 1]?
>>
>> Alternately,
>>
>> o(x)=1; % create the 0/1 vector
>> l = logical(o); % turn it into a logical one
>>
>> Too bad for things like this ML doesn't support nested assignment..
>>
>> l = logical(o(x)=1); % Doesn't work, of course... :(
>
> Well, if you are going to be like that!
>
> l = any(bsxfun(@eq,1:max(x),x.'));

Chuckle...

--
From: us on
dpb
> > l = any(bsxfun(@eq,1:max(x),x.'));
> Chuckle...

this is NOT funny - this is sheer, cruel abuse of ML syntax...

us