looking for a matlb function that convert multi-dimensional matrix into one dimentional vector

I am looking for a simple matlab function that can convert a 2-D matrix into a 1-D vector, while keeping all elements unchanged. For example, this function converts A=[1 2 3; 4 5 6; 7 8 9] into B=[1 2 3 4 5 6 7 8 9].
I remember matlab has such built in function, and I used it long time ago, but I just cannot remember its name and cannot find it via google... Anybody can help? Thank you.

 採用された回答

Friedrich
Friedrich 2011 年 7 月 18 日
Hi,
B = reshape(A',1,numel(A))
or when columnbased you can do
B = A(:);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

質問済み:

2011 年 7 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by