How to use a variable defined in an .m file in another .m file without defining the variable above?

1 回表示 (過去 30 日間)
I have an .m file called Murthy.m and "lastRR_int" and "kk" are defined in Murthy.m. This is the main GUI function and when the button is pushed, it should call Murthy.m and get those variables and place the values to edittext1 and edittext2. Here is a part of my code:
function pushbutton1_Callback(hObject, eventdata, handles)
qwertyu=Murthy(result);
set(handles.edittext1,'string' ,lastRR_int);
set(handles.edittext2, 'string' , kk-1 );
set(handles.edit6,'string','Murthy');
and Murthy.m function example:
function maxloc=Murthy(result)
%kk = something1
%lastRR_int = something2
How to fix it? Thanks in advance!
  1 件のコメント
Jan
Jan 2013 年 8 月 27 日
@Ekin: Please do not post multiple threads about the same problem. This increases out and your confusion only.

サインインしてコメントする。

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 27 日
編集済み: Azzi Abdelmalek 2013 年 8 月 27 日
Modify your function to:
function [kk,lastRR,maxloc]=Murthy(result)
kk = something1
lastRR_int = something2
When you call it, use:
[kk,lastRR,qwertyu]=Murthy(result)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWord games についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by