How can I make a vector in matlab, like vec(x)?
Show older comments
Hello all,
I am trying to replicate this formula:

I am doing so as follows:
Theta = A*B-C;
vTheta = vec(Theta');
A, B en C are defined. The problem is that Matlab does not seem to know the function 'vec' to do what I would like to do with Theta as in the formula...

How can I fix this?
Thanks in advance!
3 Comments
John D'Errico
on 1 Dec 2017
Edited: John D'Errico
on 1 Dec 2017
Only you know what the vec function means. Non-standard notation means nothing to those who are not given the definition of that notation.
Jan
on 2 Dec 2017
The problem is that Matlab does not seem to know the function 'vec'
"Does not seem" or do you get a real error message? If Matlab does not have such a function, you can fix this by writing it.
Sorry for this trivial answer, but the provided details do not allow to give a more specific one.
Marcos Caso-Huerta
on 2 Jan 2018
I think that Theta(:) is what you're looking for.
Answers (2)
Sean de Wolski
on 2 Jan 2018
1 vote
I wrote a vec function in grad school for exactly this use. Here it is, authored almost exactly 7 years ago apparently!
attached.
Giacomo Romanini
on 12 Feb 2018
Suppose you have a matrix X. You can obtain a vec(X) simply by the following:
vecX = X(:);
1 Comment
Jonathan
on 2 Aug 2018
Already answered in the comments (2 Jan 2018), so kudos to Marcos Caso-Huerta
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!