Skip to content

Commit 5aa27d9

Browse files
authored
Update load_mat_style.m (#602)
* Update load_mat_style.m * Update PynwbTutorialTest.m Add plot_read_basics to list of tutorials to skip. This tutorial does not produce NWB files that can be read with matnwb. * Simplify fix for load_mat_style
1 parent 95b5e5e commit 5aa27d9

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

+tests/+unit/PynwbTutorialTest.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
properties (Constant)
2222
% SkippedTutorials - Tutorials from pynwb to skip
2323
SkippedTutorials = {...
24+
'plot_read_basics.py', ... % Downloads file from dandi archive, does not export nwb file
2425
'streaming.py', ... % Requires that HDF5 library is installed with the ROS3 driver enabled which is not a given
2526
'object_id.py', ... % Does not export nwb file
2627
'plot_configurator.py', ... % Does not export nwb file
@@ -31,7 +32,7 @@
3132
SkippedFiles = {'family_nwb_file_0.nwb'} % requires family driver from h5py
3233

3334
% PythonDependencies - Package dependencies for running pynwb tutorials
34-
PythonDependencies = {'hdmf-zarr', 'dataframe-image', 'matplotlib', 'dandi'}
35+
PythonDependencies = {'hdmf-zarr', 'dataframe-image', 'matplotlib'}
3536
end
3637

3738
properties (Access = private)
@@ -101,7 +102,7 @@ function testTutorial(testCase, tutorialFile)
101102

102103
pythonPath = tests.util.getPythonPath();
103104

104-
cmd = sprintf('"%s" %s', pythonPath, tutorialFile );
105+
cmd = sprintf('%s %s', pythonPath, tutorialFile);
105106
[status, cmdout] = system(cmd);
106107

107108
if status == 1

+types/+untyped/@DataStub/load_mat_style.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@
4646
end
4747

4848
points = cell(length(dataDimensions), 1);
49+
50+
if isscalar(dataDimensions)
51+
% Starting in MATLAB R2024b, the input argument for the size
52+
% of an array in ind2sub must be a vector of positive integers
53+
% with two or more elements. This fix replicates the behavior of
54+
% older MATLAB versions, where it was assumed that the a scalar
55+
% size referred to the row dimension. For scalar dimensions
56+
% (i.e., row or column vectors), we can still assume this
57+
% to be true in matnwb.
58+
dataDimensions = [dataDimensions, 1];
59+
end
60+
4961
[points{:}] = ind2sub(dataDimensions, orderedSelection);
5062
readSpaceId = H5S.copy(spaceId);
5163
H5S.select_none(readSpaceId);
@@ -187,4 +199,4 @@
187199
indexKeyIndex(indexKeyIndexNextIndex) = indexKeyIndex(indexKeyIndexNextIndex) + 1;
188200
indexKeyIndex((indexKeyIndexNextIndex+1):end) = 1;
189201
end
190-
end
202+
end

0 commit comments

Comments
 (0)