Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update load_mat_style.m #602

Merged
merged 8 commits into from
Nov 4, 2024
5 changes: 3 additions & 2 deletions +tests/+unit/PynwbTutorialTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
properties (Constant)
% SkippedTutorials - Tutorials from pynwb to skip
SkippedTutorials = {...
'plot_read_basics.py', ... % Downloads file from dandi archive, does not export nwb file
'streaming.py', ... % Requires that HDF5 library is installed with the ROS3 driver enabled which is not a given
'object_id.py', ... % Does not export nwb file
'plot_configurator.py', ... % Does not export nwb file
Expand All @@ -31,7 +32,7 @@
SkippedFiles = {'family_nwb_file_0.nwb'} % requires family driver from h5py

% PythonDependencies - Package dependencies for running pynwb tutorials
PythonDependencies = {'hdmf-zarr', 'dataframe-image', 'matplotlib', 'dandi'}
PythonDependencies = {'hdmf-zarr', 'dataframe-image', 'matplotlib'}
end

properties (Access = private)
Expand Down Expand Up @@ -101,7 +102,7 @@ function testTutorial(testCase, tutorialFile)

pythonPath = tests.util.getPythonPath();

cmd = sprintf('"%s" %s', pythonPath, tutorialFile );
cmd = sprintf('%s %s', pythonPath, tutorialFile);
[status, cmdout] = system(cmd);

if status == 1
Expand Down
14 changes: 13 additions & 1 deletion +types/+untyped/@DataStub/load_mat_style.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@
end

points = cell(length(dataDimensions), 1);

if isscalar(dataDimensions)
% Starting in MATLAB R2024b, the input argument for the size
% of an array in ind2sub must be a vector of positive integers
% with two or more elements. This fix replicates the behavior of
% older MATLAB versions, where it was assumed that the a scalar
% size referred to the row dimension. For scalar dimensions
% (i.e., row or column vectors), we can still assume this
% to be true in matnwb.
dataDimensions = [dataDimensions, 1];
end

Comment on lines +49 to +60
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you are saying, yes this is a simpler solution! Good observation

[points{:}] = ind2sub(dataDimensions, orderedSelection);
readSpaceId = H5S.copy(spaceId);
H5S.select_none(readSpaceId);
Expand Down Expand Up @@ -187,4 +199,4 @@
indexKeyIndex(indexKeyIndexNextIndex) = indexKeyIndex(indexKeyIndexNextIndex) + 1;
indexKeyIndex((indexKeyIndexNextIndex+1):end) = 1;
end
end
end