Call a script via a function?

9 次查看(过去 30 天)
Hi.
Can I call (run) a script in a function? My inputs are elements of a 10x10 matrix. How would I write the output?

采纳的回答

per isakson
per isakson 2015-2-2
编辑:per isakson 2015-2-2
Look at this
>> cssm
ans =
Greeting from the script
where cssm is the function
function out = cssm()
cssm_script
end
and where cssm_script is the script
% cssm_script
out = 'Greeting from the script';
The script is running in the workspace of the calling function. The effect is the same as if the code of the script was copy&pasted into the calling function.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by