필터 지우기
필터 지우기

How to re-use parameter from other script?

조회 수: 2 (최근 30일)
Dejan Cvijanovic
Dejan Cvijanovic 2013년 9월 18일
Hi, this is my script so far:
function sens_analysis
pdemeshpop_final_re_sens
par = re;
s_nom_ss = P(length(time),7);
delta = 0.05;
par = par*(1+delta);
pdemeshpop_final_re_sens_par
s_pert_ss = P(length(time),7);
abs_sens = (s_pert_ss - s_nom_ss)/(delta*re);
rel_sens = abs_sens*(re_value/s_nom_ss);
end
I get this error: 'Undefined function or variable 're'.
Error in sens_analysis_re (line 8) par = re;'
But re is defined by user input when pdemeshpop_final_re_sens is called. How can I have it so that re is passed onto this function/script as well? Thanks!
  댓글 수: 1
Dejan Cvijanovic
Dejan Cvijanovic 2013년 9월 18일
I also need to pass par back to pedmeshpop_final_re_sens_par , so it needs to recognize par too

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 18일
make your script a function
function re=pdemeshpop_final_re_sens
  댓글 수: 2
Dejan Cvijanovic
Dejan Cvijanovic 2013년 9월 18일
I don't think you understand my question. When script is run, user inputs value for 're' and pdemeshpop_final_re_sens runs...i then want to save par as re 'par = re;'...then par is passed to pdemeshpop_final_re_sens_par ....hope that makes sense
Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 18일
I've understood your question. If you want to pass re in your function. add to your script pdemeshpop_final_re_sens
function re=pdemeshpop_final_re_sens
save your file then in your function function sens_analysis, replace
par=re
by
par=pdemeshpop_final_re_sens

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by