diff --git a/@ensemble/loadSettings.m b/@ensemble/loadSettings.m index e18f79ea..8adbd4dd 100644 --- a/@ensemble/loadSettings.m +++ b/@ensemble/loadSettings.m @@ -29,6 +29,9 @@ notEnoughMembersError(max(members), nEns, obj.file); end +% Return the variable indices in sorted order +v = sort(v); + end % Long error messages diff --git a/@ensemble/useVariables.m b/@ensemble/useVariables.m index 4a23fb16..efafcfb3 100644 --- a/@ensemble/useVariables.m +++ b/@ensemble/useVariables.m @@ -23,7 +23,7 @@ else obj.stateVector.checkVariables(varNames); varNames = string(varNames); - varNames = unique(varNames(:), 'stable'); + varNames = unique(varNames(:)); end obj.variables = varNames; diff --git a/@ensembleMetadata/extract.m b/@ensembleMetadata/extract.m index c34668b6..790c9bd7 100644 --- a/@ensembleMetadata/extract.m +++ b/@ensembleMetadata/extract.m @@ -13,6 +13,7 @@ % obj: The updated ensembleMetadata object. % Error check, variable indices +assert(~isempty(varNames), 'varNames cannot be empty'); v = dash.checkStrsInList(varNames, obj.variableNames, 'varNames', 'variable in the state vector'); % Get the variables to remove