%an example of reading file, change it, rewrite back to sqd file.

readingfilename='old.1khz.bin';
writingfilename='new.1khz.bin';
channelfilename='LH10.txt';

[data_new,channelnum,datapoints] = readingMEGfile(readingfilename,channelfilename);
[data_new_all,channelnum2,datapoints2] = readingMEGfile(readingfilename,[]);

data_new=-data_new;
data_new_all=-data_new_all;

%writingMEGfile(writingfilename,data_new); %write back only 10 channels
writingMEGfile(writingfilename,data_new_all); %write back 157 channels.