How can I sort the output of a function into columns of three

1 回表示 (過去 30 日間)
Montgomery
Montgomery 2014 年 4 月 14 日
コメント済み: Star Strider 2014 年 4 月 15 日
Hi all, I'm a beginner so apologies if this is an obvious question but I've looked through a few tutorials and help guides and can't find anything that directly answer my question.
I have an input M with 3x295. When plotted it produces a nice cyclical graph but it's a bit noisy which I wish to reduce to be able to automatically find the minima/maxima.
When I use smooth(M) I end up with an output 885x1, could you please explain how I can get this into the same 3x295 format as M. Is there a general method I can use in all my future matlab code to make sure the output is the same in structure to the input?
Thanks for your help.

採用された回答

Star Strider
Star Strider 2014 年 4 月 14 日
編集済み: Star Strider 2014 年 4 月 14 日
Try this:
Ms = (1:885)';
M = reshape(Ms, [], 3)';
Mv = M(:,1:10);
Ms is your smoothed M matrix (as a vector output from smooth), M is the reshaped version, and Mv lets you view the first few columns to be sure it’s what you want.
  2 件のコメント
Montgomery
Montgomery 2014 年 4 月 15 日
Perfct Star Strider that's exactly what I was after, thanks very much.
Star Strider
Star Strider 2014 年 4 月 15 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by