How to create null vector Matlab
95 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Bjorn Gustavsson
2021-2-18
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Array Geometries and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!