Iterating the rms-function through numbered variables

24 Views Asked by At

I have what appeared to me a simple question at first, but couldn't find a solution. Maybe I have been using wrong search terms?

In GNU Octave, I have a number of data channels (20, to be precise) in my environment, called "Channel_1_Data", "Channel_2_Data",...,"Channel_20_Data". When I run

rms(Channel_3_Data)

(or any other channel name) I get the correct answer for that channel. Now, I would like to do them all in one, but

for i=20
rms(['Channel_' i '_Data'])
endfor

gives me

error: mean: X must be a numeric vector or matrix error: called from meansq at line 65 column 5 rms at line 47 column 5

I also tried rms(strjoin({'Channel_,num2str(i),'_Data'},''), but as I should have expected that didn't help, as rms obviously doesn't want a string. As is apparent, I'm a newbie at GNU Octave and don't really understand the issue here. How can I iterate the argument in a way rms will still take it?

Thanks in advance!

0

There are 0 best solutions below