Dear all,
I'm trying to compare various signals (vectors) using the function xcov. The names of these vectors all have the form "condition_meanrate", with the prefix "condition" being variable (so e.g. I have a files called 'cedo_meanrate', sodo_meanrate', 'sosp_meanrate' etc. The variable prefixes are stored in a separate vector). I created for-loops and am using
arg_1=sprintf('%s',x,'_meanrate') arg_2=sprintf('%s',x,'_meanrate')
(with x being a char array containing the respective prefix) to feed the respective signal-vector into the xcov function:
[xcov_vec,lags]=xcov(arg_1,arg_2,'coeff').
Now the problem is that the names are fed in the way as if I'd type them using quotation marks, so like xcov('cedo_meanrate','sosp_meanrate','coeff'). Then xcov seems to compare the actual strings instead of the signal values. If I manually type xcov(cedo_meanrate,sosp_meanrate,'coeff') it works. I found a similar problem here: https://answers.yahoo.com/question/index?qid=20120416085207AAsXhqN But looking into the xcov script it says:
function [xycov,lags] = xcov(x,y,option1,option2)
I don't really know what to do now. Is there a way to feed the names into the function so that they appear as if the didn't had quotation marks?
Thanks very much! Best, Felix
Best Answer