Back to the main page.

Bug 2784 - Error in ft_mvaranalysis

Reported 2014-12-16 02:51:00 +0100
Modified 2015-07-15 13:31:25 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jan-Mathijs Schoffelen
Depends on:
See also:

Tyler - 2014-12-16 02:51:53 +0100

Hello fieldtrip, I am getting the following error: Error using .* Matrix dimensions must agree. Error in ft_mvaranalysis>catnan (line 479) datamatrix(:,begsmp:endsmp) = datacells{trials(k)}(chanindx,:).*taper(ones(nchan,1),:); Error in ft_mvaranalysis (line 385) dat = catnan(tmpdata.trial, chanindx, rpt{rlop}, tap(m,:), nnans, dobvar); Calling the size function of the two segments of code reveals: size( datacells{trials(k)}(chanindx,:)) = 123 500 size( taper(ones(nchan,1),:)) = 123 501 I looked back to see how taper is created, and tracked it back to line 166 of the code: cfg.t_ftimwin = data.time{1}(end)-data.time{1}(1) + 1/data.fsample; cfg.t_ftimwin = 0.5010 data.fsample = 1000 data.time{1}(end) = 240.6270 data.time{1}(1) = 240.1270 I apologise if this is a mistake that I have caused somehow with my data, but I thought I would submit a bug just to be sure. Kind regards, Tyler

Jan-Mathijs Schoffelen - 2015-02-11 15:31:35 +0100


Jan-Mathijs Schoffelen - 2015-02-23 11:43:10 +0100

[jansch@mentat002 fieldtrip]$ svn add test/test_bug2784.m A test/test_bug2784.m [jansch@mentat002 fieldtrip]$ svn commit -m "enhancement - created test function" test/test_bug2784.m Adding test/test_bug2784.m Transmitting file data . Committed revision 10243. So far I cannot reproduce, because I don't know the specifics of the data that was used to generate the error. The test script tests two scenarios with dummy data that contains 2 trials of different length (500 vs 501 samples), with a slight shift in the time axis. -a call to ft_mvaranalysis with an empty cfg leads to an error in the function (which is correct behavior -> different length time axes are not allowed). -a call to ft_mvaranalysis with cfg.toi=0.25 and cfg.t_ftimwin=0.5 runs without error.

Tyler - 2015-02-24 04:17:39 +0100

Created attachment 704 Data file containing four segments of data Apologies for not providing more detail, I was aware that I had provided insufficient evident. Again apologies and I am willing to give you information you require to solve the issue. I had a look at my data trying to be processed and the segment lengths were all 501 samples long, so unfortunately the problem isnt due to inconsistent segment lengths. I have attached a small section of data (in order to comply with the file size limit). I still get the error with this section of data, so hopefully it should help in solving the issue. Many thanks

Tyler - 2015-02-24 04:19:00 +0100

(In reply to Tyler from comment #3) wasnt*

Jan-Mathijs Schoffelen - 2015-02-24 09:30:04 +0100

[jansch@mentat002 fieldtrip]$ svn commit -m "enhancement - made ft_mvaranalysis more robust" ft_mvaranalysis.m test/test_bug2784.m Sending ft_mvaranalysis.m Sending test/test_bug2784.m Transmitting file data .. Committed revision 10255. I think the above changes have addressed your issue. Please get the latest version of FT (at least revision number 10255 or higher) and try whether it works for you.

Tyler - 2015-02-24 10:14:20 +0100

Sure did work. Thank you :)