Average of 3 one dimensional matrix loaded by .mat file

1 回表示 (過去 30 日間)
Asif Istiak
Asif Istiak 2021 年 12 月 29 日
コメント済み: Stephen23 2021 年 12 月 29 日
I have 3 one dimensional matrix as .mat file.
RF1=[1 3 4 9] %RF1.mat
RF1=[1 9 2 1] %RF1.mat
RF1=[1 2 4 7] %RF1.mat
I need avg Matrix RF=[(1+1+1)/3 (3+9+2)/3 (4+2+4)/3 (9+1+7)/3]
Code:
I have loaded them like
RF1=load("RF1.mat");
RF2=load("RF2.mat");
RF3=load("RF3.mat");
But, the problem is, after loading this way, I cannot make an average matrix. When I am inputting
RF=(RF1+RF2+RF3)/3
Command windows is showing like this-
Operator '+' is not supported for operands of type 'struct'.
How can I import properly and get the average matrix?

採用された回答

Chunru
Chunru 2021 年 12 月 29 日
%The following will return the structure
RF1=load("RF1.mat");
RF2=load("RF2.mat");
RF3=load("RF3.mat");
% You need to extract the data
RF1 = RF1.RF1;
RF2 = RF2.RF2;
RF3 = RF3.RF3;
% Or you can replace above by:
load("RF1.mat", "RF1");
load("RF2.mat", "RF2");
load("RF3.mat", "RF3");
  2 件のコメント
Asif Istiak
Asif Istiak 2021 年 12 月 29 日
Thanks a lot
Stephen23
Stephen23 2021 年 12 月 29 日
"% Or you can replace above by"... but loading into an output is strongly recommended.

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by