EMGLAB FORUM

EMGLAB FORUM >how to load signal in *.mat

  Subject:   how to load signal in *.mat
 
From:   victoria Date:   21 Jun 2007 12:25 am  
Reply via e-mail to victoria.  
  What I have done
1. change *.mat --->*.dat in matlab
2. use EMGlab (load EMG), to load *.dat. But the signal shown in the EMG window doesn't look the same as original one.

another way to load *.mat is to use Global varible ENGSIGNAL. I tried and failed. I didn't find the function my_emgsignal.m

Could you please tell me how to load *.mat correctly?

Thanks a lot in advance!

  >> Reply to this message  

  Subject:   Re: how to load signal in *.mat
 
From:   Kevin McGill Date:   21 Jun 2007 2:08 pm  
Reply via e-mail to Kevin McGill.  
  The easiest way to load a .mat file is like this:

global EMGSIGNAL
load ('myfile.mat');
EMGSIGNAL = mysignal;

where "mysignal" is the variable name from the .mat file.

Then choose "Import EMG signal" from the EMGlab File menu.

Note 1. my_emgsignal.m is an optional function that you create. For example, if your signals are stored in a non-standard format, you could use my_emgsignal.m to read in that format. But you don't need to create this function. EMGlab just ignores it if it doesn't exist.

Note 2. You can also convert your signal to a binary file like this:

fid = fopen ('myfile.dat','w');
fwrite (fid, mysignal, 'int16');
fclose (fid);

where "mysignal" is the name of your signal. It should be scaled so that the conversion to int16 does not degrade the information.

You should be able to load the .dat file using the "Load EMG file" command from the File Menu. If it doesn't look right, make sure you specify the byte ordering and sampling rate correctly in the EMG file format dialog box.


victoria wrote:
>What I have done
>1. change *.mat --->*.dat in matlab
>2. use EMGlab (load EMG), to load *.dat. But the signal shown in the EMG window doesn't look the same as original one.
>
>another way to load *.mat is to use Global varible ENGSIGNAL. I tried and failed. I didn't find the function my_emgsignal.m
>
>Could you please tell me how to load *.mat correctly?
>
>Thanks a lot in advance!
>
>
  >> Reply to this message  

sponsors:
Veterans Affairs Palo Alto Rehabilitation Research and Development Center
|
National Institute of Neurological Disorders and Stroke