Vector inputs in functions
2 ビュー (過去 30 日間)
古いコメントを表示
I need to put a vector input into a function and then use repmat to repeat each element a certain number of times. I have my input as repvec = (x,w), where x is the vector and w is the number of times to repeat it. I keep getting an error that says repvec is undefined. This is my code:
function vec = repvecR2(x,w)
n = length(x)
vec = repmat(w,1:n)
end
0 件のコメント
回答 (1 件)
Walter Roberson
2015 年 9 月 23 日
You called your function repvecR2 but you are trying to invoke repvec without the R2
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!