Back to the main page.
Bug 1933 - ft_convert_units crashes with NaN in input
| Status | CLOSED FIXED |
| Reported | 2013-01-16 16:23:00 +0100 |
| Modified | 2013-06-06 15:12:51 +0200 |
| Product: | FieldTrip |
| Component: | core |
| Version: | unspecified |
| Hardware: | PC |
| Operating System: | Windows |
| Importance: | P3 normal |
| Assigned to: | Johanna |
| URL: | |
| Tags: | |
| Depends on: | |
| Blocks: | |
| See also: |
Johanna - 2013-01-16 16:23:40 +0100
I found this with bug 1932 (which resulted in .pnt with NaN), but is general to any input with NaN I think. The problem is the subfunction idrange, which computes 'siz' output of the range of values. This should only be computed on 'isfinite' elements of input, not all elements.
Johanna - 2013-01-16 16:25:30 +0100
I can fix this if this should be fixed by simple modification to idrange.
Johanna - 2013-01-16 16:52:27 +0100
New change committed: function r = idrange(x) keeprow=true(size(x,1),1); for l=1:size(x,2) keeprow = keeprow & isfinite(x(:,l)); end sx = sort(x(keeprow,:), 1); ii = round(interp1([0, 1], [1, size(x(keeprow,:), 1)], [.1, .9])); % indices for 10 & 90 percentile r = diff(sx(ii, :)); bash-4.1$ svn commit forward/ft_convert_units.m Sending forward/ft_convert_units.m Transmitting file data . Committed revision 7336.