Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
??? Attempted to access temp(2); index out of bounds because numel(temp)=1.

Subject: ??? Attempted to access temp(2); index out of bounds because numel(temp)=1.

From: Alexandra

Date: 13 Jun, 2013 15:24:17

Message: 1 of 2

I encountered this error " ??? Attempted to access temp(2); index out of bounds because numel(temp)=1." when trying to display the maximum value of an ECG signal. The error occurs on this line "if (temp(k)>0)".
Here is the bit of code where it is included.
Thanks in advance


l=1;
for k=1:10
    if (max(k)>1)
        max2(l)=max(k);
        l=l+1;
    end
end
max2

l=1;
for k=1:4
    if (temp(k)>0)
        temp_max_limpo(l)=temp(k);
        l=l+1;
    end
end

Subject: ??? Attempted to access temp(2); index out of bounds because numel(temp)=1.

From: Josh Meyer

Date: 13 Jun, 2013 16:13:48

Message: 2 of 2

Where do you define temp? temp has one element, so you probably defined
'temp = <some number>' earlier in the code.

"Alexandra " <alexandrabvgdias@isep.ipp.pt> wrote in message
news:kpco71$mev$1@newscl01ah.mathworks.com...
> I encountered this error " ??? Attempted to access temp(2); index out of
> bounds because numel(temp)=1." when trying to display the maximum value of
> an ECG signal. The error occurs on this line "if (temp(k)>0)".
> Here is the bit of code where it is included.
> Thanks in advance
>
>
> l=1;
> for k=1:10
> if (max(k)>1)
> max2(l)=max(k); l=l+1;
> end
> end
> max2
>
> l=1;
> for k=1:4
> if (temp(k)>0)
> temp_max_limpo(l)=temp(k); l=l+1;
> end
> end

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us