There doesn't seem to be an easy way to check if a variable exists in a given file, and unfortunately the IMatFile indexer throws an exception when a variable does not exist. It would be useful to have a more tolerant way to access variables, such as one of the following:
- have
IMatFile[string] return null if variable does not exist
- add
IMatFile.TryGetVariable(string, out IVariable) method
- expose the underlying dictionary as
IReadOnlyDictionary<string, IVariable>
There doesn't seem to be an easy way to check if a variable exists in a given file, and unfortunately the
IMatFileindexer throws an exception when a variable does not exist. It would be useful to have a more tolerant way to access variables, such as one of the following:IMatFile[string]returnnullif variable does not existIMatFile.TryGetVariable(string, out IVariable)methodIReadOnlyDictionary<string, IVariable>