Re: Can this be vectorised?
DaveW wrote:
Hi,
I've got two vectors X and Y. I want to create a new vector Z which
has
the same number of entries as Y and each element the result of a
conditional expression applied to the original X i.e.
Z = X(X < Y);
This fails because both X and Y are vectors. Is there a syntax that
allows me to iterate on each y in Y without using a for loop?
i.e.
i=1:length(Y)
X(i) = X(X<Y(i));
end
Dave
That expression works for me provided x and y are the same length
.
Relevant Pages
- Re: formula to count charcter in a range
... you use of the word "effectively" is meant to cover the fact that, for example, in "*w*w*", once one 'w' is found, the search loop must continue on in order to look for the next 'w'. ... Your formula would iterate through range as many times as there are ... argument contains wildcards isn't as simple as my SUBSTITUTE call. ... in range, A were the number of sequential entries in instance_array, ... (microsoft.public.excel.worksheet.functions) - Re: formula to count charcter in a range
... Your formula would iterate through range as many times as there are ... argument contains wildcards isn't as simple as my SUBSTITUTE call. ... EACH entry in range, approximating an inner loop. ... in range, A were the number of sequential entries in instance_array, ... (microsoft.public.excel.worksheet.functions) - Re: Can this be vectorised?
... DaveW wrote: ... the same number of entries as Y and each element the result of a ... allows me to iterate on each y in Y without using a for loop? ... (comp.soft-sys.matlab) - Can this be vectorised?
... the same number of entries as Y and each element the result of a ... Is there a syntax that ... allows me to iterate on each y in Y without using a for loop? ... (comp.soft-sys.matlab) - RE: Creating a que
... and entry count in a collection. ... if eo.Count> 0 then bMoreData = True ... At the beginning of the loop you assume this is the last time through the ... Then you go through each item in the Entries ... (microsoft.public.excel.programming) |
|