필터 지우기
필터 지우기

How to use cellfun?

조회 수: 5 (최근 30일)
Paolo Ottonelli
Paolo Ottonelli 2020년 1월 9일
댓글: Paolo Ottonelli 2020년 1월 9일
Hello, I have 2 cell arrays (XM and YM), both of them have 3 separated cells. The first array has x values of a certain function while the second has the respective y. I have to perform a non linear regression using the last squares so I created the interpolant function and a objective function to be minimized. Is possible obtain a 3x1 cell where i can find the output patameters without divide the initial arrays using A = cellfun(func,C)?
The following code shows how i have done; it works but I wouldn't like to separate the original arrays'cells
YM=3x1cell
XM=3x1cell
[c1,val1] = fminbnd(@(c0)objfunc(YM1{1},deg(c0,XM{1},'other input parameters')),cm,cM); %deg is my interpolant function, objfunc is my objective function
[c2,val2] = fminbnd(@(c0)objfunc(YM1{2},deg(c0,XM{2},'other input parameters')),cm,cM);
[c3,val3] = fminbnd(@(c0)objfunc(YM1{3},deg(c0,XM{3},'other input parameters')),cm,cM);

채택된 답변

Stephen23
Stephen23 2020년 1월 9일
fun = @(x,y) fminbnd(@(c0)objfunc(y,deg(c0,x,'other input parameters')),cm,cM);
[C,V] = cellfun(fun,XM,YM,'Uni',0)
  댓글 수: 1
Paolo Ottonelli
Paolo Ottonelli 2020년 1월 9일
Thank you so much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by