the code exits the loop

I was working with the following code and worked perfectly today. Do not know why strange reason decided not to make me all calculations but remains in a previous iteration , I tested both put < = o + 1 but long out of the dimensions of the array, initialized to 0 but returns error .
the code is as follows:
%promedio
fid = fopen('cvv_ROAG_PTBB.dat');
d = textscan(fid,'%s %f %f');
fclose(fid);
nume = ((sin(d{2}(1)))^2)*(d{3}(1));
den = ((sin(d{2}(1)))^2);
long = length(d{1});
i=1;
j=1;
while (i < long)
if (strcmp(d{1}(i),d{1}(i+1)) )
i = i+1;
nume = nume + ((sin(d{2}(i)))^2)*(d{3}(i));
den = den + ((sin(d{2}(i)))^2);
else
x_cv(j,1) = nume/den;
i = i + 1;
j = j + 1;
nume =((sin(d{2}(i)))^2)*(d{3}(i));
den =((sin(d{2}(i)))^2);
end
end
in the event of failure , See not , someone could tell me how I can get the data d {1} if they have been verified by strcmp to be the same length so that x_cv

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Preguntada:

el 21 de Ag. de 2015

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by