📄 rdpat.m
字号:
function [Files,Names,Ear,Date,dtaPath]=rdpat(dire);
%RDPAT reads patient information of ILO88 dta-files in directory dire
% [Files,Names,Ear,Date,Path]=rdpat(dire)
% in: dire directory to read from (default gives uigetfile)
%
% out: Files names of all dta-files (string matrix)
% Names names of patients in files (string matrix)
% Ear which ear was measured, Left or Right (string matrix)
% Date dates of measurements (string matrix)
% dtaPath path of file location
% (c) Pekka Kumpulainen 4.8.1993 (P.K. 23.9.93) 15.9.1997 ML5
if nargin == 1; dtaPath=[dire '\'];
else [f,p]=uigetfile('*.dta','Choose any file in the directory');
dtaPath=p;
if f == 0; error('Cancelled'); end
end
D = dir([dtaPath '\*.dta']);
[m,n] = size(D);
Names = zeros(m,20);
Ear = zeros(m,5);
Date = zeros(m,9);
Files=zeros(m,12);
for ii= 1:m;
Files(ii,:)=char(D(ii).name);
fid=fopen([dtaPath D(ii).name],'rb');
fread(fid,1,'uchar');
Names(ii,:)=setstr(fread(fid,20,'uchar')');
ind=abs(Names(ii,:))==0;
Names(ii,:)=dos2ansi(setstr(Names(ii,:)+ ' '*ind));
fread(fid,1,'uchar');
earstr=setstr(fread(fid,5,'uchar')');
ind=abs(earstr)==0;
earstr=setstr(earstr + ' '*ind);
if earstr(1) == 'l' | earstr(1) == 'L';
Ear(ii,:)= 'Left ';
elseif earstr(1) == 'r' | earstr(1) == 'R';
Ear(ii,:)='Right';
else
Ear(ii,:)=earstr;
end
fread(fid,1,'uchar');
d=setstr(fread(fid,6,'uchar')');
Date(ii,:)=[d([5 6]) '.' d([3 4]) '.-' d([1 2])];
fclose(fid);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -