How to create null vector Matlab

100 visualizaciones (últimos 30 días)
Afluo Raoual
Afluo Raoual el 18 de Feb. de 2021
Comentada: Just Manuel el 18 de Feb. de 2021
Dear members
I have matrix with size M*N and vector with size 1*K
I want to create a null vector with length of N - length of K
I tried this :
V=zeros(1,length(N)-length(K));
but it doesn't work. Any solution please ?
Thank you.
  3 comentarios
Afluo Raoual
Afluo Raoual el 18 de Feb. de 2021
I get an unexpected result which is:
1*0 empty double row vector
Just Manuel
Just Manuel el 18 de Feb. de 2021
Yep, then go with Bjorn Gustavsson's answer.
Cheers
Manuel

Iniciar sesión para comentar.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 18 de Feb. de 2021
First off if you've done something like:
N = 12;
M = 14;
K = 7;
Mtr = randn(M,N);
V = rand(1,K);
V=zeros(1,length(N)-length(K));
Then you only check the length of the 1-by-1 arrays N and K - and the difference of that is zero. If your N and K are your arrays you might have run into a situation where N < K, because this also happens when N < K. Perhaps you've mixed up the dimensions of your matrix and you meant to make something like this:
V=zeros(1,M - K);
HTH
  4 comentarios
Afluo Raoual
Afluo Raoual el 18 de Feb. de 2021
It's done. Thank you :)
Just Manuel
Just Manuel el 18 de Feb. de 2021
You're welcome.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Array Geometries and Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by