简体   繁体   中英

How do I convert the double to vector in matlab?

I have a function which only take vector as input; however, I need to use rand(x) as input variable but rand function only returns a double type. Is there any way to convert double to vector?? Thank you very much!

here are a few ways:

X = rand(1, 10);

VE1 = X(:);

VE2 = reshape(X, 1, []);

VE3 = reshape(X, numel(X), 1);

reference: www.mathworks.com/matlabcentral/answers/44156

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM