Truncating Data Sets of Different Size

7 ビュー (過去 30 日間)
Joseph
Joseph 2013 年 9 月 4 日
OK, this should be fairly simple but I'm still not sure how to go about it. I have many sets of data, each with somewhere between 35000 and 40000 data points. I need to compare these data sets but I only need to compare them to the point of the lowest number of data points between the sets. So if I have sets 1, 2, and 3 with 36000, 37500, and 40000 data points respectively, and I compare sets 1 and 2 I am only using the first 36000 data points of the second set. Or if I compare sets 1, 2, and 3 I am only using the first 36000 data points of the second and third sets. What I need, I suppose, is a way to store my data in separate arrays and then delete the unneeded data in each array before the comparison. Thank you for your help.
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 4 日
This is not clear, give a short example with 3 vectors and give the expected result

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

採用された回答

dpb
dpb 2013 年 9 月 4 日
編集済み: dpb 2013 年 9 月 5 日
Given x,y,z as the three data vectors,
lmin=min([length(x) length(y) length(z)]);
Now just use
[x|y|z](1:lmin)
for whatever you need to do. Or, to shorten the notation, simply write
x=[x(1:lmin) y(1:lmin) z(1:lmin)];
clear y z
and the various columns
res=yourcomparisonfunction( x(1,:),x(2,:) );
say, for x and y. Or however your computations go, of course.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by