making different signals equal in length
古いコメントを表示
Hi, I am working with a set of data and i need all of them to be the same length. how can i do this?
採用された回答
その他の回答 (2 件)
Walter Roberson
2012 年 12 月 3 日
S1 = size(FirstMatrix);
S2 = size(SecondMatrix);
MaxS = max(S1, S2);
if MaxS(1) > S1(1); FirstMatrix(end+1:MaxS(1), :) = 0; end
if MaxS(2) > S1(2); FirstMatrix(:, end+1:MaxS(2)) = 0; end
if MaxS(1) > S2(1); SecondMatrix(end+1:MaxS(1), :) = 0; end
if MaxS(2) > S2(2); SecondMatrix(:, end+1:MaxS(2)) = 0; end
You can simplify this a bit if you are using vectors and you know the orientation of the vectors.
3 件のコメント
Walter Roberson
2012 年 12 月 3 日
Ah... did you want to do this by clipping the longer ones to the length of the shorter?
Lisa Justin
2012 年 12 月 3 日
編集済み: Lisa Justin
2012 年 12 月 3 日
chaitanya
2016 年 2 月 27 日
thanks..it is useful
Muruganandham Subramanian
2012 年 12 月 3 日
0 投票
Can you provide the data? you can do it by adding zeros, ones, any desirable data to the data having minimum sizes from data having maximum sizes by initializing max. data length caustiously..
カテゴリ
ヘルプ センター および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!