2016-11-25 53 views
0

如何在matlab中發佈函數?當我點擊發布腳本文件時,我希望被調用的函數也是已發佈文檔的一部分。在2016b這似乎內置,但我沒有看到這在2015a。我也沒有找到有關這種差異的足夠文件。在matlab中發佈調用函數(使用)

實施例:

%% HW-5 Q.1.a 
% clear command screen and close all open figures if present 
clc; 
close all; 

% display title: HW-#-Question.Number.SubSection 
disp('HW-5-Q.1.a'); 
disp('Start of Program!'); 
A = 5; 
B = 2; 
res = 'The result is: '; 
GetSum(A, B, res); 
GetDiff(A,B, res); 
disp('End of Program!'); 

function [ ] = GetDiff(num1, num2, StringRes) 
%GETDIFF Summary of this function goes here 
% Detailed explanation goes here 
R = num1 - num2; 
X = ['For Sum: ', StringRes, num2str(R)]; 
disp(X); 
end 

function [ ] = GetSum(num1, num2, StringRes) 
%GETSUM Summary of this function goes here 
% Detailed explanation goes here 
R = num1 + num2; 
X = ['For Sum: ', StringRes, num2str(R)]; 
disp(X); 
end 
+0

我不確定我是否理解問題所在。 R2015a與R2016b具有相同的「包含代碼」選項。 – excaza

+0

好吧,'包含代碼'設置爲true。但是,我沒有看到這些功能正在發佈。 –

回答