Back to the main page.

# Bug 1563 - ft_sourceinterpolate using 'spline' interpolation crashes on win64/Matlab 2010b

Status | CLOSED FIXED |

Reported | 2012-06-27 16:38:00 +0200 |

Modified | 2012-08-23 14:02:03 +0200 |

Product: | FieldTrip |

Component: | core |

Version: | unspecified |

Hardware: | PC |

Operating System: | Windows |

Importance: | P3 normal |

Assigned to: | Jörn M. Horschig |

URL: | |

Tags: | |

Depends on: | |

Blocks: | |

See also: |

## Jörn M. Horschig - 2012-06-27 16:38:39 +0200

I dunno why, the exact same code, same data (loaded from disk) works on the mentats and e.g. 'cubic' interpolation works under windows... error: ??? Index exceeds matrix dimensions. Error in ==> interpn>splinen at 739 xxi{i} = xi{i}(ind{:}); Error in ==> interpn at 254 vi = splinen(x,v,y,ExtrapVal); Error in ==> ft_sourceinterpolate>my_interpn at 481 av(sel) = interpn(fv, ax(sel), ay(sel), az(sel), interpmethod); Error in ==> ft_sourceinterpolate at 385 av( sel) = my_interpn(fv, ax(sel), ay(sel), az(sel), cfg.interpmethod, cfg.feedback); >> which interpn C:\Program Files\MATLAB\R2010b\toolbox\matlab\polyfun\interpn.m under linux: >> which interpn /opt/matlab2009b/toolbox/matlab/polyfun/interpn.m But under linux I also observed to real differences between the different interpolation methods...

## Jörn M. Horschig - 2012-07-25 15:27:30 +0200

hm, interesting: same data, loaded from disk: matlab, win32 selecting subvolume of 67.6% matlab win64 selecting subvolume of 67.4% gonna continue looking for the cause

## Jörn M. Horschig - 2012-07-25 15:52:00 +0200

okeee, I give up why the subvolume difference is there... apparently the / operation gives different output going from matlab 2009b to matlab 2010b, maybe the algorithm got changed anyway, apart from this peculiarity, the error was simply that the interpolation in chunks was wrongly programmed. It was checked whether the last sample/index is strictly bigger than the total amount. In my particular example of data, it was just an even match, which should suffice for the loop to stop. However, it tried one last iteration with no data, which failed of course Thus, instead of checking for sel(end)>num, the check needs to be sel(end)>=num svn ci ft_sourceinterpolate.m -m "bugfix-#1563-interpolation chunk management fixed when #indices divisible by 20 without remainder" Sending ft_sourceinterpolate.m Transmitting file data . Committed revision 6289.