Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Index in position 1 is invalid. Array indices must be positive integers or logical values.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
dpb
ha marcado con alerta este/a pregunta
Hi. following mistake message:
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in Laser_V2_Bersin_Sven (line 85)
new_roi = filtered(Schwerpunkte_X(i) - delta_x(i) : Schwerpunkte_X(i) + delta_x(i), Schwerpunkte_Y(i) - delta_y(i) : Schwerpunkte_Y(i) + delta_y(i));
here is the code:
for j = 1 : length(name)
delta_x(i) = 1.5.*dx(i,1);
delta_y(i) = 1.5.*dy(i,1);
new_roi = filtered(Schwerpunkte_X(i) - delta_x(i) : Schwerpunkte_X(i) + delta_x(i), Schwerpunkte_Y(i) - delta_y(i) : Schwerpunkte_Y(i) + delta_y(i));
structROI(i).ROI= new_roi;
new_ROIdiff = [1,1];
new_ROIoffset =[0, 0];
en_density = sum(sum((new_roi)));
[row,column] = size(new_roi);
xv = (1:column);
yv = (1:row).';
first_Moment_X(j,1) = sum(xv .* new_roi, 'all');
Schwerp_X = first_Moment_X(j) / en_density;
Schwerpunkte_X(j) = Schwerp_X;
first_Moment_Y(j,1) = sum(yv .* new_roi, 'all');
Schwerp_Y = first_Moment_Y(j) / en_density;
Schwerpunkte_Y(j) = Schwerp_Y;
sec_Moment_X(j,1) = sum((xv - Schwerp_X).^2 .* new_roi, 'all');
Sigma_X_plural(j) = sec_Moment_X(j)/en_density;
sec_Moment_Y(j,1) = sum((yv - Schwerp_Y).^2 .* new_roi, 'all');
Sigma_Y_plural(j) = sec_Moment_Y(j) / en_density;
sec_Moment_XY(j,1) = sum((xv - Schwerp_X) .* (yv - Schwerp_Y) .* new_roi, 'all');
Sigma_XY_plural(j) = sec_Moment_XY(j) / en_density;
%Berechnung des Strahldurchmessers nach Formel 18 und 19 in Norm
dxPixel(j) = 2*sqrt(2)*(sqrt(Sigma_X_plural(j) + Sigma_Y_plural(j)+sign(Sigma_X_plural(j)-Sigma_Y_plural(j)).*(sqrt(((Sigma_X_plural(j)-Sigma_Y_plural(j)).^2)+4*(Sigma_XY_plural(j).^2)))));
dyPixel(j) = 2*sqrt(2)*(sqrt(Sigma_X_plural(j) + Sigma_Y_plural(j)-sign(Sigma_X_plural(j)-Sigma_Y_plural(j)).*(sqrt(((Sigma_X_plural(j)-Sigma_Y_plural(j)).^2)+4*(Sigma_XY_plural(j).^2)))));
dx(j,1) = dxPixel(j) * Pixelgroesse; %Umrechnung von Pixel in Mikrometer
dy(j,1) = dyPixel(j) * Pixelgroesse; %Umrechnung von Pixel in Mikrometer
dz(j,1) = zaxe; %Nur um alles am selben Fleck zu haben
endfor j = 1 : length(name)
delta_x(i) = 1.5.*dx(i,1);
delta_y(i) = 1.5.*dy(i,1);
new_roi = filtered(Schwerpunkte_X(i) - delta_x(i) : Schwerpunkte_X(i) + delta_x(i), Schwerpunkte_Y(i) - delta_y(i) : Schwerpunkte_Y(i) + delta_y(i));
structROI(i).ROI= new_roi;
new_ROIdiff = [1,1];
new_ROIoffset =[0, 0];
en_density = sum(sum((new_roi)));
[row,column] = size(new_roi);
xv = (1:column);
yv = (1:row).';
first_Moment_X(j,1) = sum(xv .* new_roi, 'all');
Schwerp_X = first_Moment_X(j) / en_density;
Schwerpunkte_X(j) = Schwerp_X;
first_Moment_Y(j,1) = sum(yv .* new_roi, 'all');
Schwerp_Y = first_Moment_Y(j) / en_density;
Schwerpunkte_Y(j) = Schwerp_Y;
sec_Moment_X(j,1) = sum((xv - Schwerp_X).^2 .* new_roi, 'all');
Sigma_X_plural(j) = sec_Moment_X(j)/en_density;
sec_Moment_Y(j,1) = sum((yv - Schwerp_Y).^2 .* new_roi, 'all');
Sigma_Y_plural(j) = sec_Moment_Y(j) / en_density;
sec_Moment_XY(j,1) = sum((xv - Schwerp_X) .* (yv - Schwerp_Y) .* new_roi, 'all');
Sigma_XY_plural(j) = sec_Moment_XY(j) / en_density;
%Berechnung des Strahldurchmessers nach Formel 18 und 19 in Norm
dxPixel(j) = 2*sqrt(2)*(sqrt(Sigma_X_plural(j) + Sigma_Y_plural(j)+sign(Sigma_X_plural(j)-Sigma_Y_plural(j)).*(sqrt(((Sigma_X_plural(j)-Sigma_Y_plural(j)).^2)+4*(Sigma_XY_plural(j).^2)))));
dyPixel(j) = 2*sqrt(2)*(sqrt(Sigma_X_plural(j) + Sigma_Y_plural(j)-sign(Sigma_X_plural(j)-Sigma_Y_plural(j)).*(sqrt(((Sigma_X_plural(j)-Sigma_Y_plural(j)).^2)+4*(Sigma_XY_plural(j).^2)))));
dx(j,1) = dxPixel(j) * Pixelgroesse; %Umrechnung von Pixel in Mikrometer
dy(j,1) = dyPixel(j) * Pixelgroesse; %Umrechnung von Pixel in Mikrometer
dz(j,1) = zaxe; %Nur um alles am selben Fleck zu haben
end
Schwerpunkte_X(i) is defined as:
first_Moment_X(i,1) = sum(xv .* ROI, 'all');
Schwerp_X = first_Moment_X(i) / en_density;
Schwerpunkte_X(i) = Schwerp_X;
can anyone help me please?
2 comentarios
John D'Errico
el 30 de Abr. de 2022
That is NOT all of your code. That is only a part of your code, so nobody can try to execute it. Worse, that same line appears twice in your code, so we don't even know which of those two lines is causing the problem. And since we don't have your complete code, we have no idea which one is line 85.
Learn to use the debugger.
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!