subtract an average value from a range
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a matrix of 3000x6000. Also I have some values which I treated as nose_pokes. From every nose poke value I want two things.
1) 50 columns before nose poke I want to add them and then take an average of them which in result give me a matrix of 3000x1(which becomes base line of my signal).
2) After each nose poke I have to take 100 columns and subtract the baseline from all columns one by one and rest of the data remains same.
I write down some code but I am unable to perform this task can any body help me.
I want to upload file but its too big I can't upload.

code:
fileread = csvread('Data190409_224329trial_rec_data.csv');
subdat1=reshape(fileread,[3000 length(fileread)/3000]); %array to matrix conversion
for ki= 1:1:(size(nose_pok,2)-1)
qw1=nose_pok(ki)-80;
qw2=nose_pok(ki)-40;
base_rec_range = subdat1(:,qw1:qw2);
range=size(base_rec_range,2);
sum=0
for m=1:1:range
sum = sum + base_rec_range(:,m);
end
base_rec=sum/range;
for index = 1:length(nose_pok)
data_reshaped(:,nose_pok(index):nose_pok(index)+100)=subdat1(:,nose_pok(index):nose_pok(index)+100)-base_rec(:,1);
end
end
1 件のコメント
Rik
2019 年 4 月 18 日
Can you write a small example input and output pair? I have the feeling this should be relatively straightforward, but I am unsure what exactly you mean.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!