0

嗨,我有以下 4D 矩阵

for idx_number_panels = 1:length(number_panels) % range of PV panel units examined

for number_turbines = 0:2 % range of wind turbine units examined

    for number_batteries = 1:10 % range of battery units examined


        for h=2:25 %# hours

            for d = 1:number_of_days %# which day

                n = h + 24*(d-1);
                % hourly_deficit_1(...,..., h, d)= Demand(n)-(PV_supply(n)... %


                hourly_total_RES(idx_number_panels,number_turbines + 1,number_batteries, h,d)

我想从上面的 4D 矩阵中每 24 行删除整行,从而调整矩阵的大小。这是否可能以及如何完成,因为文档似乎没有帮助

谢谢

4

1 回答 1

0
  1. 制作要保留的所有行索引的向量
  2. 仅索引那些 hourly_total_RES 行并分配回 hourly_total_RES。

    垃圾idx = 1:24:idx_number_panels;

    keepidx = setdiff(1:idx_number_panels,trashidx);

    hourly_total_RES = hourly_total_RES(keepidx,:,:,:);

而且我不知道为什么上面没有格式化为代码....

于 2012-07-30T23:13:06.320 回答