|
"Steven_Lord" <slord@mathworks.com> wrote in message <iufe85$fkg$1@newscl01ah.mathworks.com>...
> "Floris Zoutman" <fzoutman@hotmail.com> wrote in message
> news:iueq3l$hr2$1@newscl01ah.mathworks.com...
> > I am trying to speed up part of my code but I cannot find a way to do it
> > faster. This is the problem I am working on. I have 4 arrays: number and
> > LKN_EN are each 67000*1. Hcat and LKN_ENcat are each 175000*11. I tried to
> > combine them in the following way: My first try:
> > tmp2=zeros(size(number,1),size(Hcat,2));
> > for i=1:length(number)
> > for j=1:size(Hcat,2) tmp(2i,j)=any(Hcat(:,j)==number(i)) &&
> > any(LKN_ENcat(:,j)==(LKN_EN(i)));
> > end
> > end
> Let's take a step back. Please explain, in words rather than code or
> equations, what you intend this code to do. ......
> Steve Lord
- - - - - - - - - - -
I think Steve is right to ask what you wish this result to do for you. In the first place, tmp2 will have a whopping big 11,725,000,000 elements in it, and you are probably spending most of your compute time swapping virtual memory in and out. However, secondly it seems axiomatic that you will not be able to do anything useful with such an enormous array without further processing it to the point where a mere human being could make some sense out of it. The very name "tmp2" is a strong hint of that. This suggests that you might conceivably be able to get to such a final human-accessible result without ever generating the entire tmp2 array. In other words we are (or at least I am) suggesting that you might be guilty of using a brute force technique on something that calls for far more finesse.
Roger Stafford
|