필터 지우기
필터 지우기

Array indices must be positive integers or logical values. Error in ecgtest (line 9) chestNoDC=​chest1(0:1​0000)- meanChest;

조회 수: 1 (최근 30일)
I'm facing this problem whenever I try to plot my values from "0"
Array indices must be positive integers
or logical values.
Error in ecgtestCAH (line 9)
chestNoDC=chest1(0:10000)- meanChest;
can you suggest me what to do to avoid this?
  댓글 수: 3
Image Analyst
Image Analyst 2021년 9월 22일
@Shayan Sepahvand, Can you post your answer below in the Answer Section, not up here in comments where we ask the poster for clarification? Thanks. That way, the poster can "Accept" your answer and you can get reputation points for it.

댓글을 달려면 로그인하십시오.

채택된 답변

Shayan Sepahvand
Shayan Sepahvand 2021년 9월 22일
편집: Shayan Sepahvand 2021년 9월 22일
Hi,
The first element of a vector is addressed by 1, not 0: (one-based indexing not zero-based)
X = ones(1000,1);
X = [1:20]%the first 20 elements
X = [0:20]% you will get an error.
try this:
chestNoDC=chest1(1:10000)
  댓글 수: 2
Ghufran Abdul Qayum
Ghufran Abdul Qayum 2021년 9월 22일
@Shayan Sepahvand what do i have to do to show my signal values that are on point 'zero' in the graph then?
Steven Lord
Steven Lord 2021년 9월 22일
If you call plot with one numeric input MATLAB will use the indices of the elements as the X data, starting at 1.
plot((1:10).^2, 'o-') % using 1:10 as the X data
If you call plot with two numeric inputs MATLAB will use the first as the X data and the second as the Y data.
plot(-10:-1, (1:10).^2, 'o-')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by