Skip to content

Commit d13947a

Browse files
authored
Fix detection of MatNWB version (#770) (#771)
* Fix issue 770 - Version check now works for any name of the MATNWB folder * Update installation.rst Add note taking into consideration that ver() requires the input of the actual folder name of the matnwb installation
1 parent eeab63c commit d13947a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

+misc/getMatnwbVersion.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function matnwbVersion = getMatnwbVersion()
2+
% getMatnwbVersion - Get current version of MatNWB
3+
4+
% Find name of MatNWB folder.
5+
[~, matnwbFolderName] = fileparts( misc.getMatnwbDir() );
6+
matnwbInfo = ver(matnwbFolderName);
7+
8+
matnwbVersion = matnwbInfo.Version;
9+
end

NwbFile.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ function addWasGeneratedBy(obj)
335335
obj.general_was_generated_by = obj.general_was_generated_by.load();
336336
end
337337

338-
matnwbInfo = ver('matnwb');
339-
wasGeneratedBy = {'matnwb'; matnwbInfo.Version};
338+
matnwbVersion = misc.getMatnwbVersion();
339+
wasGeneratedBy = {'matnwb'; matnwbVersion};
340340

341341
if isempty(obj.general_was_generated_by)
342342
obj.general_was_generated_by = wasGeneratedBy;

docs/source/pages/getting_started/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Run this quick check in MATLAB to verify that MatNWB is installed:
100100
101101
versionInfo = ver("matnwb")
102102
103-
You should see a structure with MatNWB version information.
103+
You should see a structure with MatNWB version information. NB. If your matnwb folder has a different name, replace "matnwb" with the actual name of your matnwb folder
104104

105105

106106
Update or uninstall

0 commit comments

Comments
 (0)