【问题标题】:Creating a function on matlab that adds numbers to the end of words在matlab上创建一个将数字添加到单词末尾的函数
【发布时间】:2016-11-22 16:50:41
【问题描述】:

Said question

亲爱的朋友们,

我才刚刚开始使用 matlab,因此不太确定如何为我的问题集回答这个问题。

有人能帮我解决这个问题吗?

干杯

【问题讨论】:

    标签: matlab


    【解决方案1】:

    因为今天是你的幸运日,所以我会发布一个答案,它以一种不明显的方式解决了这个问题,但你可以从中学到最多。

    或者,你知道,取得好成绩但不及格。

    下一次,请自己尝试; 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
    

    【讨论】:

    • 我的也投了反对票,所以我把它删了。猜猜帮助人们获得否决票。适得其反,但无论如何...... :(
    猜你喜欢
    • 2019-04-30
    • 1970-01-01
    • 1970-01-01
    • 2023-01-10
    • 2016-06-19
    • 2019-08-25
    • 1970-01-01
    • 2015-07-12
    • 2012-03-13
    相关资源
    最近更新 更多