Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Vectorial inclusions inter
Replies: 5   Last Post: Jun 28, 2013 5:57 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Abel

Posts: 31
Registered: 5/29/13
Re: Vectorial inclusions inter
Posted: Jun 28, 2013 5:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

And moreover I managed to do it like this :

function Z=original_event(X,Y)

Z=zeros(size(X,1),4);

for i = 1 : size(X,1)
for j = 1 : size(Y,1)
if X(i,1)>= Y(j,1) && X(i,2) <= Y(j,2)
Z(i,1:2)=X(i,:);
Z(i,3:4)=Y(j,:);
end

end


It works but it is not fast. The problem is X and Y must contain thousands of datas. So I would like to avoid the for loops. I asked someone to give a try to the solution with bsxfun and it works with its Matlab versions but, according to him, it is slower than my original_event function. So I don't know what to do but I would like to know if there a possiblity to avoid any loops, or to combine them in some ways.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.