MATLAB GUI編程中幾個有用的程序段

1  啓動

% 獲取當前文件所在路徑

currPath = fileparts(mfilename('fullpath'));

% 切換工作路徑到當前位置

cd(currPath);

% 判斷所用操作系統

if computer == 'PCWIN'

    % MATLAB版本號

    v = version;

    if v(1)~='7'        

        warndlg ('Only run in matlab 7.x(R14.x)');

        return

else

        % 添加當前路徑下的所有子目錄

        addpath(genpath(pwd));

        addpath(genpath(currPath));

    end

end

2  GUI中使用Axes控件

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章