Hello Matlab Community,
I have a problem, when different functions have different input variables. Then functions I call want of course all input variables. But I don't want to code for every function a single code. Do you have any idea, how I can "bundle" or something similar the input variables to loop them through the whole code with all called functions?
function [R, H, J] = RS(@func,@func2,x,y,eta, S)[H] = F1(func, x ,y, eta, S); % called function 1
[J] = F2(func2,x,y,eta, S); % called function 2
H_inv = inv(H);R = (H_inv*J*H_inv);R = sqrt(diag(R));end
in the example, the input variables "x,y,eta, S" are only for the RS function needed, but every func and func2 I want to run, have different number of input variables and different input variables. I've tried this
f = @(theta,eps,L,K,B,LK,FK,D)func(theta,eps,L,K,B,LK,FK,D);f2 = @(theta,eps,L,K,B,LK,FK,D,ti,gi)func2(theta,eps,L,K,B,LK,FK,D,ti,gi);function [R, H, J] = RS(f,f2,x,y,eta, S)[H] = F1(f, x ,y, eta, S); % called function 1[J] = F2(f2,x,y,eta, S); % called function 2H_inv = inv(H);R = (H_inv*J*H_inv);R = sqrt(diag(R));end
but, that doesn't work. Thanks in advance.
Best Answer