How to do padding of values in array?

2 ビュー (過去 30 日間)
Michael
Michael 2012 年 1 月 3 日
I have 5 files which has different set of values(varying in length), now i should make all files of equal length. For example file1 has 1028 data, and file2 has 1056, files3 has 1044, file4 has 1050 & file5 has 1042. Now i should make all files of length 1056(maximum length), for doing this i should add values to other files(i can add the median values of the existing data). I cant use padarray function.
Please provide me a sample code to do this!!!!

回答 (1 件)

Wayne King
Wayne King 2012 年 1 月 3 日
x = randn(1028,1);
x = [x ; median(x).*ones(1056-1028,1)];

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by