Recursive directory search for all models
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
My professor and I want to test a system for all the models present in a directory. Instead of passing all the models separately by using varargin, can I somehow generate all the models in a directory as a string,so that I can split it across a .slx and get the models and test my system in one go????
0 Kommentare
Antworten (1)
Abhas
am 5 Jul. 2023
Hi Rohit,
Instead of writing a recursive function to get all the models of a directory, you can use a simple regex match. The line of code attached below will return a structure array with many fields, one of which is the name field. You can use the dot operator to access all the names or you can use the struct2cell function which will directly return the whole structure as cell array, which you can filter out to get the .slx models.
models=dir(fullfile(dirPath,'**/*.slx'));
You can refer this link to know more about :- https://www.mathworks.com/help/matlab/ref/regexp.html
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Search Path finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!