Issue loading .rhs files from Intan

Hello, I'm having issues with uploading RHS files from Intan. The read_Intan_RHS2000_bst_2018.m file is having issues what appears difference in array sizes (see attachment). I don't have any issues with reading in the files when using Intan's read_Intan_RHS2000_file.m script, which I'm guessing is the foundation for Brainstorm's script to read it in. Could someone help me with triaging this issue?

Using MATLAB 2022b on a Windows 64-bit computer

Indeed, read_Intan_RHS2000_bst_2018.m is based on read_Intan_RHS2000_file.m.

Can you please share a short example file, for us to try and reproduce this issue?
(upload the file somewhere and post the download link here)

Also check this thread on reading .rhd files with read_Intan_RHD2000_bst_2022 based on read_Intan_RHD2000_file, it may point to insights on what is going with your file
Importing events from Intan (.rhd) recordings and saving them to brainvision core data format/edf

@Raymundo.Cassani the only files I have to share are ~770 MB. Is that too big?

Thanks for the additional forum post. It didn't set off any alarm bells but I'm in the process of analyzing the code to see if I can make heads of tails of things.

These are the variables that I get when I run {read_Intan_RHS2000_file.m}

Name                         Size                      Bytes  Class      Attributes

  amp_settle_data            108x1800064             194406912  logical              
  amplifier_channels           1x108                    133976  struct               
  amplifier_data             108x1800064            1555255296  double               
  board_dig_in_channels        1x2                        3312  struct               
  board_dig_in_data            2x1800064              28801024  double               
  charge_recovery_data       108x1800064             194406912  logical              
  compliance_limit_data      108x1800064             194406912  logical              
  frequency_parameters         1x1                        2640  struct               
  notes                        1x1                         504  struct               
  reference_channel            1x3                           6  char                 
  spike_triggers               1x108                     48640  struct               
  stim_data                  108x1800064            1555255296  double               
  stim_parameters              1x1                         880  struct               
  t                            1x1800064              14400512  double

The issue appears when extracting digital input channels to separate variables. The board_dig_in_data is a 2x128 matrix due to 2 num_board_dig_in_channels; and board_dig_in_raw is a 1x256. I'm not exactly sure how to correct this though.

@Raymundo.Cassani here's the link to the file : https://drive.google.com/file/d/1UTsAZmjFkDP9eaa4J-Jcudfy9n8kuH4m/view?usp=drive_link

Thank you @neuronick for the sample file, it was useful for finding and fixing the bug (commit 696240d)
Update your Brainstorm, instance to get this fix

1 Like

Thanks for looking into this and providing a fix.
As a note, I created the protocol --> add subject --> import raw data file and didn't work the first time, but I ran the process again and it worked. Not sure why, but I've done this with other MATLAB GUIs before and it's worked. Adding this note in case someone else runs into the same issue.