error using zeros in matlab
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
JT
el 18 de Nov. de 2015
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 comentarios
Akhil Sen Roy
el 4 de Oct. de 2017
Editada: Akhil Sen Roy
el 4 de Oct. de 2017
so whats the final answer ?? did you manage to solve it ?
Respuesta aceptada
John D'Errico
el 20 de Nov. de 2015
Editada: John D'Errico
el 20 de Nov. de 2015
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!