Matlab - Ayuda con una iteración

 
Vista:

Ayuda con una iteración

Publicado por mario rivera (1 intervención) el 06/12/2020 16:45:00
Cordial saludo programadores,

Quisiera reducir esta sentencia pero no logro hacerlo efectivamente. Esta sentencia se hizo para promediar todas las coordenadas puntuales de 119 matrices matrices de 31x46X12 y rellenar una matriz 31x46x12 de NaN con esos valores promedio. Si se dan cuenta en cada "parte" de la sentencia kp va incrementando uno a uno su valor. Pero no he podido lograr generar una iteración para ello y Matlab me arroja un "error"

Error: File: TERCER_SCRIPT_TRITON3.m Line: 147 Column: 3601
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.


SENTENCIA:


1
2
3
4
5
6
7
8
9
10
11
12
13
kp=1;
 for lg=1:31
     for lt=1:46
        for p=1:42
 
promedioMTEMP=(SERIETEMPENE(lg,lt,p,kp,1)+SERIETEMPENE(lg,lt,p,kp+1,1)+SERIETEMPENE(lg,lt,p,kp+2,1)+SERIETEMPENE(lg,lt,p,kp+3,1)+SERIETEMPENE(lg,lt,p,kp+4,1)+SERIETEMPENE(lg,lt,p,kp+5,1)+SERIETEMPENE(lg,lt,p,kp+6,1)+SERIETEMPENE(lg,lt,p,kp+7,1)+SERIETEMPENE(lg,lt,p,kp+8,1)+SERIETEMPENE(lg,lt,p,kp+9,1)+SERIETEMPENE(lg,lt,p,kp+10,1)+SERIETEMPENE(lg,lt,p,kp+11,1)+SERIETEMPENE(lg,lt,p,kp+12,1)+SERIETEMPENE(lg,lt,p,kp+13,1)+SERIETEMPENE(lg,lt,p,kp+14,1)+SERIETEMPENE(lg,lt,p,kp+15,1)+SERIETEMPENE(lg,lt,p,kp+16,1)+SERIETEMPENE(lg,lt,p,kp+17,1)+SERIETEMPENE(lg,lt,p,kp+18,1)+SERIETEMPENE(lg,lt,p,kp+19,1)+SERIETEMPENE(lg,lt,p,kp+20,1)+SERIETEMPENE(lg,lt,p,kp+21,1)+SERIETEMPENE(lg,lt,p,kp+22,1)+SERIETEMPENE(lg,lt,p,kp+23,1)+SERIETEMPENE(lg,lt,p,kp+24,1)+SERIETEMPENE(lg,lt,p,kp+25,1)+SERIETEMPENE(lg,lt,p,kp+26,1)+SERIETEMPENE(lg,lt,p,kp+27,1)+SERIETEMPENE(lg,lt,p,kp+28,1)+SERIETEMPENE(lg,lt,p,kp+29,1)+SERIETEMPENE(lg,lt,p,kp+30,1)+SERIETEMPENE(lg,lt,p,kp+31,1)+SERIETEMPENE(lg,lt,p,kp+32,1)+SERIETEMPENE(lg,lt,p,kp+33,1)+SERIETEMPENE(lg,lt,p,kp+34,1)+SERIETEMPENE(lg,lt,p,kp+35,1)+SERIETEMPENE(lg,lt,p,kp+36,1)+SERIETEMPENE(lg,lt,p,kp+37,1)+SERIETEMPENE(lg,lt,p,kp+38,1)+SERIETEMPENE(lg,lt,p,kp+39,1)+SERIETEMPENE(lg,lt,p,kp+40,1)+SERIETEMPENE(lg,lt,p,kp+41,1)+SERIETEMPENE(lg,lt,p,kp+42,1)+SERIETEMPENE(lg,lt,p,kp+43,1)+SERIETEMPENE(lg,lt,p,kp+44,1)+SERIETEMPENE(lg,lt,p,kp+45,1)+SERIETEMPENE(lg,lt,p,kp+46,1)+SERIETEMPENE(lg,lt,p,kp+47,1)+SERIETEMPENE(lg,lt,p,kp+48,1)+SERIETEMPENE(lg,lt,p,kp+49,1)+SERIETEMPENE(lg,lt,p,kp+50,1)+SERIETEMPENE(lg,lt,p,kp+51,1)+SERIETEMPENE(lg,lt,p,kp+52,1)+SERIETEMPENE(lg,lt,p,kp+53,1)+SERIETEMPENE(lg,lt,p,kp+54,1)+SERIETEMPENE(lg,lt,p,kp+55,1)+SERIETEMPENE(lg,lt,p,kp+56,1)+SERIETEMPENE(lg,lt,p,kp+57,1)+SERIETEMPENE(lg,lt,p,kp+58,1)+SERIETEMPENE(lg,lt,p,kp+59,1)+SERIETEMPENE(lg,lt,p,kp+60,1)+SERIETEMPENE(lg,lt,p,kp+61,1)+SERIETEMPENE(lg,lt,p,kp+62,1)+SERIETEMPENE(lg,lt,p,kp+63,1)+SERIETEMPENE(lg,lt,p,kp+64,1)+SERIETEMPENE(lg,lt,p,kp+65,1)+SERIETEMPENE(lg,lt,p,kp+66,1)+SERIETEMPENE(lg,lt,p,kp+67,1)+SERIETEMPENE(lg,lt,p,kp+68,1)+SERIETEMPENE(lg,lt,p,kp+69,1)+SERIETEMPENE(lg,lt,p,kp+70,1)+SERIETEMPENE(lg,lt,p,kp+71,1)+SERIETEMPENE(lg,lt,p,kp+72,1)+SERIETEMPENE(lg,lt,p,kp+73,1)+SERIETEMPENE(lg,lt,p,kp+74,1)+SERIETEMPENE(lg,lt,p,kp+75,1)+SERIETEMPENE(lg,lt,p,kp+76,1)+SERIETEMPENE(lg,lt,p,kp+77,1)+SERIETEMPENE(lg,lt,p,kp+78,1)+SERIETEMPENE(lg,lt,p,kp+79,1)+SERIETEMPENE(lg,lt,p,kp+80,1)+SERIETEMPENE(lg,lt,p,kp+81,1)+SERIETEMPENE(lg,lt,p,kp+82,1)+SERIETEMPENE(lg,lt,p,kp+83,1)+SERIETEMPENE(lg,lt,p,kp+84,1)+SERIETEMPENE(lg,lt,p,kp+85,1)+SERIETEMPENE(lg,lt,p,kp+86,1)+SERIETEMPENE(lg,lt,p,kp+87,1)+SERIETEMPENE(lg,lt,p,kp+88,1)+SERIETEMPENE(lg,lt,p,kp+89,1)+SERIETEMPENE(lg,lt,p,kp+90,1)+SERIETEMPENE(lg,lt,p,kp+91,1)+SERIETEMPENE(lg,lt,p,kp+92,1)+SERIETEMPENE(lg,lt,p,kp+93,1)+SERIETEMPENE(lg,lt,p,kp+94,1)+SERIETEMPENE(lg,lt,p,kp+95,1)+SERIETEMPENE(lg,lt,p,kp+96,1)+SERIETEMPENE(lg,lt,p,kp+97,1)+SERIETEMPENE(lg,lt,p,kp+98,1)+SERIETEMPENE(lg,lt,p,kp+99,1)+SERIETEMPENE(lg,lt,p,kp+100,1)+SERIETEMPENE(lg,lt,p,kp+101,1)+SERIETEMPENE(lg,lt,p,kp+102,1)+SERIETEMPENE(lg,lt,p,kp+103,1)+SERIETEMPENE(lg,lt,p,kp+104,1)+SERIETEMPENE(lg,lt,p,kp+105,1)+SERIETEMPENE(lg,lt,p,kp+106,1)+SERIETEMPENE(lg,lt,p,kp+107,1)+SERIETEMPENE(lg,lt,p,kp+108,1)+SERIETEMPENE(lg,lt,p,kp+109,1)+SERIETEMPENE(lg,lt,p,kp+110,1)+SERIETEMPENE(lg,lt,p,kp+111,1)+SERIETEMPENE(lg,lt,p,kp+112,1)+SERIETEMPENE(lg,lt,p,kp+113,1)+SERIETEMPENE(lg,lt,p,kp+114,1)+SERIETEMPENE(lg,lt,p,kp+115,1)+SERIETEMPENE(lg,lt,p,kp+116,1)+SERIETEMPENE(lg,lt,p,kp+117,1)+SERIETEMPENE(lg,lt,p,kp+118,1)./119;
 
MMMTEMPENERO(lg,lt,p)=promedioMTEMP;
 
    end
  end
 end
save MMMTEMPENERO.mat
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Ayuda con una iteración

Publicado por Miguel Gonzalez A. (42 intervenciones) el 04/10/2023 20:17:57
for lg=1:31
for lt=1:46
for p=1:42
Prom_M = 0;
for kp=1:119
Prom_M = Prom_M + SERIETEMPENE(lg,lt,p,kp,1);
end
MMMTEMPENERO(lg,lt,p)=prom_M/119;
end
end
end
save ('File_ENERO','MMMTEMPENERO')
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar