error using zeros in matlab
조회 수: 6 (최근 30일)
이전 댓글 표시
er = zeros(1, .125*N); % eigth rest
qr = zeros(1, .25*N); % quarter rest
hr = zeros(1, .5*N); % half rest
tr = zeros(1, .75*N); % three-quarter rest
wr = zeros(1, N); % whole rest
I get the error Error using zeros Size inputs must be integers.
Error in pleasework (line 49) er = zeros(1, .125*N); % eigth rest
>>
댓글 수: 4
Akhil Sen Roy
2017년 10월 4일
편집: Akhil Sen Roy
2017년 10월 4일
so whats the final answer ?? did you manage to solve it ?
채택된 답변
John D'Errico
2015년 11월 20일
편집: John D'Errico
2015년 11월 20일
I wonder, what are the odds that N is not an integer multiple of 8?
Zeros requires integer arguments. READ THE ERROR MESSAGE! If N is not an integer multiple of 8, then when you multiply by 0.125, you get a non-integer. So you need to think about what size you really need for this vector. If I had to guess, you might want to round up or round down, but this is your code, so you are the one who knows what you wanted to do.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!