Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Help Index in position 2 exceeds array bounds (must not exceed 1).

1 visualización (últimos 30 días)
Alexa Shumaker
Alexa Shumaker el 17 de Abr. de 2019
Cerrada: madhan ravi el 17 de Abr. de 2019
I don't know what is wrong with the matrix i pass it a 1X178 in a for loop 4 times to get a conversion of WL = array of 4x178 so i can graph it. Can someone tell my what my error is I think is literally so small but I cannot see the error
clc
clear
%Patient Given File with Data
type TestPatient.txt
PI = dlmread('TestPatient.txt');
%Contants : spits out y = intensity, x = pixel data want y = intensity, x = pixel data
[n,m] = size(PI);
%patient pixel data in 5 to 8th row of text file
PW = [PI(5,:); PI(6,:); PI(7,:); PI(8,:)];
%Patient Wavelength Data
for i = 1:4
PatientWave(i,m) = Wavelength (PW(:,m),4,m);
end %end for loop
%Patient Plot
subplot(2,2,4)
plot(PI(1,:), PatientWave(1), 'b',PI(2,:), PatientWave(2), 'r',PI(3,:), PatientWave(3), 'g',PI(4,:), PatientWave(4), 'k')
title('Patient Readings')
legend('White Lights', 'IR Lights', 'Near IR Lights', 'UV Lights')
xlabel('Wavelength')
ylabel('Intensity')
%%
function f = Wavelength(x,n,m)
%n = size of rows
%m = number of columns
A0 = 3.137749190*10^2;
B1 = 2.712866004;
B2 = -1.458600858*10^-3;
B3 = -4.854192924*10^-6;
B4 = -1.392291111*10^-9;
B5 = 1.937582620*10^-11;
%x = pixel data
WL = zeros(n,m);
for i = 1: n
% for loop for column
for j = 1: m
% for loop for rows
%WL = wavelengh conversion of pixels to Wavelength
WL(i,j) = (A0 + (B1*x(i,j))+ (B2*x(i,j)^2) + (B3*x(i,j)^3)+(B4*x(i,j)^4) + (B5*x(i,j)^5));
end % end for loop
end %end for loop
f= WL;
end % end of function
  4 comentarios
madhan ravi
madhan ravi el 17 de Abr. de 2019
@Alex: Posting a question only will increase the time of getting help, also wastes others time.

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by