poster
2019-11-27, 18:11
我在Matlab上编写了一个莫尔斯电码解码器,但是没有用。我有多个文件,但是我的解码器不起作用,我还有一个由我的伴侣给我的编码器,它可以工作。
我找不到错误,甚至无法创建结构。你能帮我么?
我的细胞T是47 * 2是这样的:
'A''01'
'B''1000'
'C''1010'
'D''100'
'E''0'
function decoded = morse_decode(signal, fs) C = readtable('morsecode.dat', 'ReadVariableNames', false, ... 'Format', '%s%s', 'Delimiter', 'space'); T = table2cell(C); for i=1 : length(T)*2 if isa(T{i}, 'numeric') T{i} = num2str(T{i}); end end struc = cell2struct(T(:,1), T(:,2)); clear T morse2char = @(m) getfield(struc, m); [b,a] = butter(7,1/20); signal = filter(b,a,signal); env = abs(real(hilbert(signal))); fc=600; [b,a] = butter(2,1/fc/5); env=filter(b,a,env); thresh = mean(env)*0.9; dur=find(env thresh,1); if (dur thresh,1) - find(envthresh,1); while (any(next)) if(next
我找不到错误,甚至无法创建结构。你能帮我么?
我的细胞T是47 * 2是这样的:
'A''01'
'B''1000'
'C''1010'
'D''100'
'E''0'
function decoded = morse_decode(signal, fs) C = readtable('morsecode.dat', 'ReadVariableNames', false, ... 'Format', '%s%s', 'Delimiter', 'space'); T = table2cell(C); for i=1 : length(T)*2 if isa(T{i}, 'numeric') T{i} = num2str(T{i}); end end struc = cell2struct(T(:,1), T(:,2)); clear T morse2char = @(m) getfield(struc, m); [b,a] = butter(7,1/20); signal = filter(b,a,signal); env = abs(real(hilbert(signal))); fc=600; [b,a] = butter(2,1/fc/5); env=filter(b,a,env); thresh = mean(env)*0.9; dur=find(env thresh,1); if (dur thresh,1) - find(envthresh,1); while (any(next)) if(next