立即注册 登录
气象家园 返回首页

卑微江小澄的个人空间 http://bbs.06climate.com/?122750 [收藏] [复制] [分享] [RSS]

日志

用gpt写的一个睿智小函数,输入起始年、结束年以及一个位置可返回该位置对应的年份

已有 193 次阅读2023-9-11 10:29

function year = findYear(startYear, endYear, position)
    % 输入参数:
    % startYear: 起始年
    % endYear: 结束年
    % position: 位置
    
    % 假设年份从 startYear 到 endYear
    years = startYear:endYear;
    
    % 检查位置是否在有效范围内
    if position < 1 || position > numel(years)
        error('位置超出有效范围。');
    end
    
    % 获取位置对应的年份
    year = years(position);
end

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

返回顶部