2016-11-25 57 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。但是,我没有看到这些功能正在发布。 –

回答