diff --git a/+matnwb/+extension/installExtension.m b/+matnwb/+extension/installExtension.m index 48f30044..e349e673 100644 --- a/+matnwb/+extension/installExtension.m +++ b/+matnwb/+extension/installExtension.m @@ -1,4 +1,10 @@ function installExtension(extensionName) +% installExtension - Install NWB extension from Neurodata Extensions Catalog +% +% matnwb.extension.nwbInstallExtension(extensionNames) installs Neurodata +% Without Borders (NWB) extensions to extend the functionality of the core +% NWB schemas. + arguments extensionName (1,1) string end @@ -55,12 +61,12 @@ function installExtension(extensionName) assert(... ~isempty(L), ... 'NWB:InstallExtension:NamespaceNotFound', ... - 'No namespace file was found for extension "%s"', extension.Identifier ... + 'No namespace file was found for extension "%s"', extensionName ... ) assert(... numel(L)==1, ... 'NWB:InstallExtension:MultipleNamespacesFound', ... - 'More than one namespace file was found for extension "%s"', extension.Identifier ... + 'More than one namespace file was found for extension "%s"', extensionName ... ) generateExtension( fullfile(L.folder, L.name) ); end diff --git a/nwbInstallExtension.m b/nwbInstallExtension.m index 1c7d8516..61bf0f6a 100644 --- a/nwbInstallExtension.m +++ b/nwbInstallExtension.m @@ -1,13 +1,11 @@ -function nwbInstallExtension(extensionName) +function nwbInstallExtension(extensionNames) % nwbInstallExtension - Installs a specified NWB extension. % -% nwbInstallExtension(extensionName) installs a Neurodata Without Borders -% (NWB) extension to extend the functionality of the core NWB schemas. -% extensionName is a scalar string or a string array, containing the name -% of one or more extensions from the Neurodata Extesions Catalog -% % Usage: -% nwbInstallExtension(extensionName) +% nwbInstallExtension(extensionNames) installs Neurodata Without Borders +% (NWB) extensions to extend the functionality of the core NWB schemas. +% extensionNames is a scalar string or a string array, containing the name +% of one or more extensions from the Neurodata Extensions Catalog % % Valid Extension Names: % - "ndx-miniscope" @@ -42,7 +40,7 @@ function nwbInstallExtension(extensionName) % matnwb.extension.listExtensions, matnwb.extension.installExtension arguments - extensionName (1,:) string {mustBeMember(extensionName, [... + extensionNames (1,:) string {mustBeMember(extensionNames, [... "ndx-miniscope", ... "ndx-simulation-output", ... "ndx-ecog", ... @@ -69,11 +67,13 @@ function nwbInstallExtension(extensionName) ] ... )} = [] end - if isempty(extensionName) + if isempty(extensionNames) T = matnwb.extension.listExtensions(); extensionList = join( compose(" %s", [T.name]), newline ); error("Please specify the name of an extension. Available extensions:\n\n%s\n", extensionList) else - matnwb.extension.installExtension(extensionName) + for extensionName = extensionNames + matnwb.extension.installExtension(extensionName) + end end end diff --git a/resources/function_templates/nwbInstallExtension.txt b/resources/function_templates/nwbInstallExtension.txt index 2a7f22a8..14f090da 100644 --- a/resources/function_templates/nwbInstallExtension.txt +++ b/resources/function_templates/nwbInstallExtension.txt @@ -1,13 +1,11 @@ -function nwbInstallExtension(extensionName) +function nwbInstallExtension(extensionNames) % nwbInstallExtension - Installs a specified NWB extension. % -% nwbInstallExtension(extensionName) installs a Neurodata Without Borders -% (NWB) extension to extend the functionality of the core NWB schemas. -% extensionName is a scalar string or a string array, containing the name -% of one or more extensions from the Neurodata Extesions Catalog -% % Usage: -% nwbInstallExtension(extensionName) +% nwbInstallExtension(extensionNames) installs Neurodata Without Borders +% (NWB) extensions to extend the functionality of the core NWB schemas. +% extensionNames is a scalar string or a string array, containing the name +% of one or more extensions from the Neurodata Extensions Catalog % % Valid Extension Names: {{extensionNamesDoc}} @@ -20,16 +18,18 @@ function nwbInstallExtension(extensionName) % matnwb.extension.listExtensions, matnwb.extension.installExtension arguments - extensionName (1,:) string {mustBeMember(extensionName, [... + extensionNames (1,:) string {mustBeMember(extensionNames, [... {{extensionNames}} ... ] ... )} = [] end - if isempty(extensionName) + if isempty(extensionNames) T = matnwb.extension.listExtensions(); extensionList = join( compose(" %s", [T.name]), newline ); error("Please specify the name of an extension. Available extensions:\n\n%s\n", extensionList) else - matnwb.extension.installExtension(extensionName) + for extensionName = extensionNames + matnwb.extension.installExtension(extensionName) + end end end