MATLAB Answers

how to run a function in each cells?

조회 수: 3(최근 30일)
Sagar
Sagar 2014년 8월 5일
댓글: Sagar 2014년 8월 5일
Hi, I am using a function 'taylordiag' as follows: [ hp, ht, axl ] = taylordiag ( stn { 1 } (2, : ), stn { 1 } ( 3, : ), stn { 1 } ( 4, : ) );
where stn is a 1*23 cell. I need to execute the function 'taylordiag' in each cells i.e. in stn { 1 }, stn { 2 } .... stn { 23 }, so that I can plot all the points that I need in the same plot obtained by executing 'taylordiag'.
Could you please suggest how to do this?
Thank you,

채택된 답변

Nade Sritanyaratana
Nade Sritanyaratana 2014년 8월 5일
Have you tried cellfun ?
Below is an example of using cellfun that may fit what you are looking for:
[HP, HT, AXL] = cellfun(@(x)taylordiag(x(2,:),x(3,:),x(4,:)),stn);
  댓글 수: 1
Sagar
Sagar 2014년 8월 5일
Thank you Nade, that works.

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by