For Programmers: Free Programming Magazines  


Home > Archive > Matlab > November 2005 > Re: Replacement for For loop and IF statement in MAtlab









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Replacement for For loop and IF statement in MAtlab
htao

2005-11-11, 9:58 pm

Can you tell me more details?
Indeed you can use vectors to avoid loops. But it depends your
problems. For example,
a=[0 1 2 3 0 4 5];
% if I want to find the num==0, I would use
b = a(a==0);
%which will give you
b = [0,0]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com