MATLAB: Searching for part of variable name

ensemblesMATLABpredictive maintenancePredictive Maintenance Toolbox

I am working with the fileEnsembleDatastore tool from the predictive maintenance toolbox.
In this, you need to list DataVariables, ConditionVariables and SelectedVariables.
The data I am working with is in .mat format, each file containing 4 variables:
I want to use each variable, but only the suffix as the start of each variable name is different from file to file.
ensembleTrain = fileEnsembleDatastore(fileLocation, fileExtension);
ensembleTrain.ReadFcn = @readBearingData;
ensembleTrain.DataVariables = ["BA"; "DE"; "FE"; "RPM"];
ensembleTrain.ConditionVariables = ["label";"file"];
ensembleTrain.WriteToMemberFcn = @writeBearingData;
ensembleTrain.SelectedVariables = ["label"; "file"; "BA"; "DE"; "FE"; "RPM"]
%I'm trying to use characters that are common between the variable names
Edit: How do I search for variables with names that include parts of the name, i.e. BA, DE etc.

Best Answer

  • I don't see a question in your query. If you've got a list of variable names and you're looking for partial matches, check out the contains() function or if you need something for rigorous, regexp().