matlab 矩阵连续大于,在Matlab中使用连续矩阵(Using consecutive matrices in Matlab)

在Matlab中,创建一个用于分析多个以日期命名的矩阵的函数,对比每个月/每年的平均值。通过循环和eval函数,动态指定矩阵名以避免手动输入,计算并存储每个矩阵的平均值到MeanMatrix。
摘要由CSDN通过智能技术生成

在Matlab中使用连续矩阵(Using consecutive matrices in Matlab)

我正在创建一个在分析工作室中使用多个矩阵的函数。

矩阵的名称相同,名称中有日期参考(月份和年份:nov-1956是matrix5611 ,dec-1956是matrix5612 ,jan-1957是matrix5712 ,依此类推,直到1999年底。

对于每一个,每个月/每年的平均值之间应该进行比较(取决于您关注的研究领域)。

我正在尝试使用一些循环来改变输入矩阵的名称,而不是按日期手动编写,但是一个有用的函数。

任何想法或有用的功能?

I'm creating a function to use multiple matrices in an analysis studio.

The matrices are given with the same name with a date reference in the name (month to month and year to year: nov-1956 is matrix5611, dec-1956 is matrix5612, jan-1957 is matrix5712, and so on until the end of 1999.

For each one there should be a comparison between the mean value of each month/year (depending of what area of study are you focused on).

I'm trying to use some loops to vary the name of the input matrix instead of write manually date by date, but a function that helped would be useful.

Any idea or useful function?

原文:https://stackoverflow.com/questions/10487872

2020-02-23 22:02

满意答案

如果您的数据位于不同的矩阵中,则可以使用eval将平均值存储到某个矩阵,在本例中为MeanMatrix ,其中Y维度为年,X维度为月份:

编辑:它不是从5611运行的数字,但是yymm ...

编辑:似乎矩阵不是从1956年1月开始,而是从1956年11月开始。

% add here missing months matrix index strings.

MissingMatricesCellArray = {'5601', '5602', '5603', '5604', '5605', '5606', '5607', '5608', '5609', '5610'};

% MissingmatricesCellArray = {};

for Year = 56:99

for Month = 1:12

NumString = sprintf('%02d%02d', Year, Month);

% calculate and store means only for matrices that are not missing.

if ~(ismember (cellstr(NumString), MissingMatricesCellArray))

MeanMatrix(Year,Month) = mean(mean(eval ([ 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值