?? read.m
字號:
% read
%input_type==2
%file_input_type==3
% ******************FILE INPUT SETUP*********************************
if input_type == 2
if file_input_type == 1
%binary file input
end
if file_input_type == 2
%text file input
file = fopen(file_name,'rt');
data_samples = fread(file,'char');
fclose(file);
data_in = zeros(1,8*length(data_samples));
for i = 1:length(data_samples)
data_in(1 + (i-1)*8:(i-1)*8 + 8) = eight2bin(data_samples(i));
end
end
%**********************************************************************
%*****************
if file_input_type == 3
%sound file input
file_name;
data_samples=wavread(file_name);
%needs to be normalized from -1:1 to 0:255 for 8 bit conversion
data_samples_resized = round(128*data_samples +127);
length(data_samples_resized);
data_in = zeros(1,8*length(data_samples_resized));
for i = 1:length(data_samples_resized)
data_in(1 + (i-1)*8:(i-1)*8 + 8) = eight2bin(data_samples_resized(i));
end
data_in;
end
if file_input_type == 4
%image file input
[data_in,map]=imread(file_name); % read image and corresponding color map for display
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -