【发布时间】:2016-11-22 16:50:41
【问题描述】:
【问题讨论】:
标签: matlab
【问题讨论】:
标签: matlab
因为今天是你的幸运日,所以我会发布一个答案,它以一种不明显的方式解决了这个问题,但你可以从中学到最多。
或者,你知道,取得好成绩但不及格。
下一次,请自己尝试先; SO 不是编码服务。
function string = uniqueword(string)
persistent calls
if isempty(calls)
calls = 0; end
maxcalls = 5;
assert(ischar(string),...
[mfilename ':invalid_argument'],...
'%s takes a single string argument.',...
mfilename);
assert(calls <= maxcalls,...
[mfilename ':maxcalls_exceeded'],...
'%d words have already been created.',...
maxcalls);
calls = calls + 1;
string = [string calls+48];
end
【讨论】: