After having had this file in my librarby now for a moth, I am upping the rating to a five. The help section is still kinda child-like, but the fact is that there is no file-exchange sumbission I have used more than this little piece of code.
It may be trivial, and self-named gurus might find it beneath them to use it, but for those of us who code matlab for a living and need to type legible code accurately and fast, it is a perfect tool.
In particular:
a = rand(3,4,5,6);
b = mean(flat(a(:,1,:,2));
Is as legible and as hard to get wrong as they come.
14 Apr 2009
flat
flatten a matrix, i.e. make it a vector
Author: Vincent
This is a function that I have been lacking for a while. The real fix would be to allow sum() std() etc to accept a vector as the dimension argument, but untill Mathworks fixes that, this will give cleaner code.
But yeah, get that help line fixed.
24 Jun 2008
flat
flatten a matrix, i.e. make it a vector
Author: Vincent
x@y.z, Jos
This submission (still) lacks a proper help section (H1 line, example, See Also line). Therefore, I doubt this will be useful to anyone who does not has any experience in matlab syntax.
Moreover, flat(x) equals reshape(x,1,[]) in all respects, but in the latter it is immediately clear (possibly after typing "help reshape") that you will end up with a row vector. "help flat" tells you nothing useful ...
My rating of 2 stars reflects the needed improvement of the help section.
21 Jun 2008
flat
flatten a matrix, i.e. make it a vector
Author: Vincent