Prev: XML Parsing
Next: using data generated in one callback in GUI in another callbackin the same GUI
From: Matt Fig on 30 Mar 2010 18:10 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);
From: Matt Fig on 30 Mar 2010 18:11 "james bejon" <jamesbejon(a)yahoo.co.uk> wrote in message <hotso5$2ib$1(a)fred.mathworks.com>... > Thanks for all the really helpful replies! > > I'm currently toying with the (perhaps hungry?) expression: > > ismember((1:A(end)), A) > > (I can assume A is in ascending order) That works, but it will be slower and less readable than many of the other solutions.
From: Walter Roberson on 30 Mar 2010 18:14 dpb wrote: > 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. But if you have logical() at your disposal, then you could use o(x) = logical(1); So now who is going to give us an answer in terms of logical(accumarray(...)) ? ;-)
From: Oleg Komarov on 30 Mar 2010 19:04 Walter Roberson > dpb wrote: > > 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. > > But if you have logical() at your disposal, then you could use > > o(x) = logical(1); > > > So now who is going to give us an answer in terms of logical(accumarray(...)) > ? ;-) Out = accumarray(A.',true,[],@logical); Another versione :). Only if unique(A) == A.
From: Oleg Komarov on 30 Mar 2010 19:05
Walter Roberson > dpb wrote: > > 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. > > But if you have logical() at your disposal, then you could use > > o(x) = logical(1); > > > So now who is going to give us an answer in terms of logical(accumarray(...)) > ? ;-) Out = accumarray(A.',true,[],@logical); Another versione :). Only if unique(A) == A. |