필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
Alexa Shumaker
Alexa Shumaker 2019년 4월 17일
마감: madhan ravi 2019년 4월 17일
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
madhan ravi
madhan ravi 2019년 4월 17일
@Alex: Posting a question only will increase the time of getting help, also wastes others time.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by