- #1
ghostyc
- 26
- 0
Hi,
I am writing a Matlab function(script), which take some input.
I have several datasets in the workspace, say dataset1,dataset2,dataset3, ect
In my function, I have tried to use
data = input('Please input your dataset', 's')
and then use 'data' as a variable for some computation, say
sum(data);
mean(data);
It does not work. I wonder what's the 'correct' way to do it?
=====================================================
OR, I can add an argument in myfunction, say
function y = myf(ds,para)
use 'ds' to indicate the dataset that i want to use.
However, in this case, how should i use 'fminsearch' for optimization?
'fminsearch' will then treat this 'ds' input as a parameter.
=====================================================
Thanks!
I am writing a Matlab function(script), which take some input.
I have several datasets in the workspace, say dataset1,dataset2,dataset3, ect
In my function, I have tried to use
data = input('Please input your dataset', 's')
and then use 'data' as a variable for some computation, say
sum(data);
mean(data);
It does not work. I wonder what's the 'correct' way to do it?
=====================================================
OR, I can add an argument in myfunction, say
function y = myf(ds,para)
use 'ds' to indicate the dataset that i want to use.
However, in this case, how should i use 'fminsearch' for optimization?
'fminsearch' will then treat this 'ds' input as a parameter.
=====================================================
Thanks!