Mat files with different vectors length

Hi, I have two mat files the size of one mat file is 7741*1 and the other one is 74434*1. Is there any possible way to make them of equal size ?

5 件のコメント

Guillaume
Guillaume 2018 年 9 月 6 日
編集済み: Guillaume 2018 年 9 月 6 日
Is there any possible way to make them of equal size ?
Possibly. As you haven't told us anything about what you want to do with them or why you want them the same size, we can't answer. You could just tack some constant number at the end of the shortest one (0 or NaN, probably), you could interpolate the shortest one (but how you define the interpolation again depends on why you want to match the size) or you could fix the bug that create a vector of an incorrect size if that's the problem.
By the way, it doesn't sound that you have mat files (files with .mat extension on disk which don't have mxn size). What you are describing sounds like vectors.
Stephen23
Stephen23 2018 年 9 月 6 日
"Is there any possible way to make them of equal size ?"
Of course: padding, subsampling, interpolation, ... which method do you want to use?
Husnain Ahmed
Husnain Ahmed 2018 年 9 月 6 日
Actually the data in these mat files has time values collected from the same position sensor but in two different PCs. Now when i plot the position against the time the one signal lags. I want to remove this lag. I hope it clears the purpose if it does not then please feel free to ask.
Guillaume
Guillaume 2018 年 9 月 6 日
How do you know the timing of each vector? If you don't have that information (or the sampling rate and start time of each) then there's nothing you can do.
Husnain Ahmed
Husnain Ahmed 2018 年 9 月 6 日
Sampling time of one PC is 1e-2 sec and other PC is 1e-3.

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

回答 (1 件)

KSSV
KSSV 2018 年 9 月 6 日

0 投票

You need to do interpolation.......Read about interp1.

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2018 年 9 月 6 日

コメント済み:

2018 年 9 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by