フィルターのクリア

I have a 720x20 matrix how can i subtract 1x20 matrix from it?

1 回表示 (過去 30 日間)
mohsen moslemin
mohsen moslemin 2016 年 9 月 2 日
コメント済み: mohsen moslemin 2016 年 9 月 2 日
clc
clear
signal_factor=10;
format long
folder='E:\Pressure split';
filetype='*.xlsx';
f=fullfile(folder,filetype);
d=dir(f);
for k=1:numel(d);
data{k}=xlsread(fullfile(folder,d(k).name));
end
data=cell2mat(data);
A=data(:,1);
A=A(80:end,1);
n = 720;
m = numel(A);
out = reshape([A(:);nan(mod(-m,n),1)],n,[]);
out=out*signal_factor;
min=min(out);
This is my code, it generates 720x20 matrix and the min also generates 1x20 matix what i want is to subtract first value of min from out (subtract a constant value from all the 720 values) and so on.
  4 件のコメント
PRUDHVI RAJU
PRUDHVI RAJU 2016 年 9 月 2 日
min=repmat(min,720,1); % 720 rows same 'min' row matrix
sub=out-min;
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 9 月 2 日
Don't use the built-in function min as a variable

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

採用された回答

Adam
Adam 2016 年 9 月 2 日
編集済み: Adam 2016 年 9 月 2 日
res = bsxfun( @minus, out, minVal);
should work if I understand correctly what you are asking.
Don't ever call a variable 'min' though, especially not when you are also using the function 'min' which you hide after your variable gets created (but really just never do it, irrespective of whether you are using the 'min' function in your code or not).
  1 件のコメント
mohsen moslemin
mohsen moslemin 2016 年 9 月 2 日
Thanks it works, and thx for the tips, i changed it to minVal.

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

その他の回答 (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