I keep getting A(I) = B, the number of elements in B and I must be the same. matlab error
Ältere Kommentare anzeigen
last=0;
upflag=0;
p=zeros(length(detsq),1);
for i=1:length(detsq)
if(detsq(i)>1000)
if(upflag ==0)
if(last>0)
t= i-last;
p=1000/t*60
end
last=i;
end
upflag=100;
else
if(upflag>0)
upflag=upflag-1;
end
end
pulse(i)=p;
end
figure(3),plot(pulse)
In an assignment A(I) = B, the number of elements in B and I must be the same
This is the error keep popping. Any experts who can help me identify where I went wrong?
Antworten (4)
Image Analyst
am 29 Nov. 2013
0 Stimmen
Is it your intention that p should be a vector, like you said here: p=zeros(length(detsq),1);
or is it your intention that p should be a scalar like you say here: p=1000/t*60
If you do this: pulse(i)=p; then p must be a scalar. Though I'm just guessing at the line of code producing the error because, for some strange reason, you left out that crucial part of the error message that identifies the line of code that caused the error.
2 Kommentare
John
am 29 Nov. 2013
Image Analyst
am 29 Nov. 2013
Undefined function or variable 'b2'.
Error in test (line 3)
det =filter (b2, 1, firs6);
John
am 29 Nov. 2013
5 Kommentare
Image Analyst
am 29 Nov. 2013
Error using load
Unable to read file 'ecg_8.dat': no such file or directory.
Error in test2 (line 1)
load 'ecg_8.dat'
John
am 29 Nov. 2013
Image Analyst
am 29 Nov. 2013
You can't have negative or fractional indexes, OR stuff a bunch of elements into a single element. Step through your code until it throws an error, then examine all the variables and see what violates what I said in the first sentence of this comment.
John
am 29 Nov. 2013
0 Stimmen
Kategorien
Mehr zu ECG / EKG finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!