Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Calling a function by looping through a vector
Date: Sun, 27 Sep 2009 04:23:00 +0000 (UTC)
Organization: Georgetown University
Lines: 21
Message-ID: <h9mpb4$b0r$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1254025380 11291 172.30.248.35 (27 Sep 2009 04:23:00 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 27 Sep 2009 04:23:00 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 729891
Xref: news.mathworks.com comp.soft-sys.matlab:573156


Hello everybody,
I'm trying to call a function that takes a vector and does performs an operation on it.
I have multiple vectors to send it so I though of sending the vectors in a loop:

a, b and c are all vectors.

x = ['a' 'b' 'c'];

for i = 1 : length(x)
    PerformOperation(x(i))
end

instead of:

PerformOperation(a)
PerformOperation(b)
PerformOperation(c)

Could somebody tell me how to call my function by looping through a vector? The second solution seems like a hack and I'm trying to learn the best possible way to do this.

Much appreciated.