sir i have 2 m files one is
function mm
r=[1 2 3]
end
saved with name mm.m
the other is
function nn
% some code. I need r!
end
saved with name nn.m
I want to access value of r in file nn.m.
What is statement to access this r???

 채택된 답변

Image Analyst
Image Analyst 2014년 3월 28일

0 개 추천

Have mm.m be this:
function r = mm()
r=[1 2 3]
end
And have nn.m be this:
function nn
% some code.
% Get r from mm():
r = mm;
end

추가 답변 (1개)

Wayne King
Wayne King 2014년 3월 28일

0 개 추천

Why don't you have the function, nn.m, output the value of r, then the function mm can use that value. That is the best way to do it.
Alternatively, look at the help for global

댓글 수: 1

Jitesh Bhanushali
Jitesh Bhanushali 2014년 3월 28일
how to save vqlue r as r.m file n use it in another m file

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

카테고리

도움말 센터File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

질문:

2014년 3월 28일

댓글:

2014년 3월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by