⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loadhex32.m

📁 extension de ns-2 about umts and wimax imlemented on linux
💻 M
字号:
% function [data32] = loadhex32(infilex, infiley, N)
% load two 16 bit hex files generated by dspdebugger, the first file contains
% x data and the second file contains y data. This program combines 
% the two data file and return a decimal array of 32 bit data value,
% and plot it. The two 16 bit hex files should have the same address range for
% most case unless special arranged data otherwise.
% input: filename (infile) and number of characters in a row (N)
%			Usually, N is 20.
function [data32] = loadhex32(infile, N)
  fid1 = fopen(infile,'r');
  dat1 = fscanf(fid1,'%s');
  fclose(fid1);
  M = size(dat1,2)/N;
  dat3 = repmat('a',M,8);
  for i=1:M
    dat2(i,:) = dat1(N*(i-1)+(N-7):N*i);
  end
  data32 = hex2dec(dat2);
  for k=1:size(data32,1);
     if data32(k) > hex2dec('7fffffff');
        data32(k) = -bitcmp(data32(k),32)-1;
     end
  end
  
%    for k=1:size(data32,1);
%        data32(k) = data32(k)/2^16;
%  end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -