Errors in Matlab when analyzing fly videos

92 views
Skip to first unread message

Vaishnavi Mantraratnam

unread,
Jan 21, 2021, 5:26:55 PM1/21/21
to ctrax
Hi all! I am so grateful to be a part of this google group!!

I am conducting research and using Ctrax and Matlab. I installed the BehavioralMicroarray Matlab Toolbox correctly and Matlab correctly.

I have some fly videos in avi format and I already ran them through CTRAX and after tracking, exported the data as a .mat file.

I opened Matlab and tried to run showtrx.m and some errors are occurring. Can you help me fix the following errors - 

Unrecognized function or variable 'aviread_rawy8'.

Error in get_readframe_fcn>aviread_helper (line 248)
  M = aviread_rawy8(filename,f);

Error in get_readframe_fcn>@(f)aviread_helper(filename,f,fps) (line 190)
          readframe = @(f) aviread_helper(filename,f,fps);

Error in showtrx>PlotFirstFrame (line 139)
im = handles.readframe(handles.f);

Error in showtrx>showtrx_OpeningFcn (line 97)
handles = PlotFirstFrame(handles);

Error in gui_mainfcn (line 220)
    feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure),
    varargin{:});

Error in showtrx (line 22)
    gui_mainfcn(gui_State, varargin{:});
 

Alice Robie

unread,
Jan 21, 2021, 5:47:46 PM1/21/21
to ct...@googlegroups.com
Looking at the code I think you hit this because your video can't be read by matlab's VideoReader function. 
Can you try reading your video with VideoReader directly and see if it works? 
-Alice 

function [im,stamp] = aviread_helper(filename,f,fps)

 

if numel(f) == 2,

  M = aviread_rawy8(filename,f(1):f(2)); % JAB 8/6/17 - I don't know if aviread_rawy8() ever existed,

                                         % or where it came from if it did. This code hasn't worked

                                         % since 2016 at the latest.

else

  M = aviread_rawy8(filename,f);

end


--
You received this message because you are subscribed to the Google Groups "ctrax" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ctrax+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ctrax/025d552f-47ec-455d-98a5-d469494393e5n%40googlegroups.com.

Vaishnavi Mantraratnam

unread,
Jan 26, 2021, 4:50:53 PM1/26/21
to ctrax
The error is still persisting -

I tried opening my .avi files with Ctrax and it somehow did not work with the Matlab codes found in the Behavioral Microarray Toolbox and it also did not work with VideoReader.
Would anyone of you recommend I use Micro Fly Movie Format for Ctrax and then try the Matlab codes with that?

Alice Robie

unread,
Jan 26, 2021, 4:55:21 PM1/26/21
to ct...@googlegroups.com
Yes - if you can't convert your avi videos to a format that matlab can read, then converting them to ufmf format would make them readable by ctrax for sure.
Alice

Vaishnavi Mantraratnam

unread,
Jan 31, 2021, 7:57:53 PM1/31/21
to ctrax
I tried using the sample data from the Ctrax website here http://ctrax.sourceforge.net/ctrax.html#usage and it was able to open one of the sample flies' video on Ctrax. However, I tried running it on Matlab and errors happened again. Help anyone?

Unrecognized function or variable 'isdummytrk'.

Error in process_data (line 62)
   if isdummytrk( data(fly) ), continue, end

Error in compute_perframe_stats_f (line 123)
  trx = process_data(trx,matname);

Error in compute_perframe_stats_social_f (line 104)
    compute_perframe_stats_f('matname',matnameonly,'matpath',matpath,'docomputeclosest',false);
 
>> 
Reply all
Reply to author
Forward
0 new messages