Detrending data changing matrix size

3 ビュー (過去 30 日間)
Katherine Benson
Katherine Benson 2023 年 11 月 6 日
コメント済み: Voss 2023 年 11 月 6 日
Hi there,
The following line of code is kicking back the error "Unable to perform assignment because the size of the left side is 128-by-27 and the size of the right side is 1-by-27"
DFRT.data(1:128,:) = 'detrend(DFRT.data(1:128,:))';
My understanding was that the detrend function would center the data and remove the linear trend, but would not change data structure or the number of values. Any insight here would be much appreciated!

回答 (1 件)

Voss
Voss 2023 年 11 月 6 日
Do you mean this?
DFRT.data(1:128,:) = detrend(DFRT.data(1:128,:));
  2 件のコメント
Katherine Benson
Katherine Benson 2023 年 11 月 6 日
If I change the code to that I get a different error: Index in position 1 exceeds array bounds. Index must not exceed 1.
Voss
Voss 2023 年 11 月 6 日
That could be because DFRT.data has only one row, but you are asking for rows 1 through 128.
Or it could be that you have a variable called detrend, which is preventing MATLAB from running the detrend function and instead MATLAB is interpreting the command as indexing into the variable detrend.
Check for a variable in your code called detrend and rename it to something else, and if your code is a script, then run the following on the command-line and then run your script again:
clear detrend

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

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by