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.