Effacer les filtres
Effacer les filtres

Trouble running tutorial example Predictive Maintenance in Hydraulic Pump in 2022a

1 vue (au cours des 30 derniers jours)
Nena
Nena le 4 Oct 2023
Réponse apportée : Yash le 11 Oct 2023
Hello,
I have downloaded the triplex_pump project from the official site: https://www.mathworks.com/matlabcentral/fileexchange/65605-predictive-maintenance-in-hydraulic-pump
I open the project Triplex_Pump.prj to begin, but it seems that the files with the data do not exist (see the attatched file). What is the problem?
Thanks in advance,
Nena

Réponses (1)

Yash
Yash le 11 Oct 2023
Hi Nena,
I understand that you are encountering a "No such file or directory" error while trying to open the project "Triplex_Pump.prj". I was able to reproduce the error at my end. The error occurs because the directory "Data" doesn't exist inside the "Workflows\Fault_Sweep" directory. The "sm_pump_triplex_DOEdata_tocsv" function uses the following code to determine if "Data" directory exists or not and creates it if it doesn't exist.
% Make data directory if it doesn't exist
if ~exist('Data', 'dir')
mkdir('Data')
end
However "exist('Data', 'dir')" returns 7 indicating that "Data" is a folder even when "Data" directory doesn't exist in the current directory and hence "~exist('Data', 'dir')" evaluates to false. I suspect this is because while checking for existence of "Data" directory no path information is provided. Refer here for more information on "exist" function: https://www.mathworks.com/help/matlab/ref/exist.html
To resolve the issue, you can employ any of the following methods:
  • Manually create the "Data" directory. Navigate to "Workflows\Fault_Sweep" and create the directory "Data" here.
  • Modify the code in "sm_pump_triplex_DOEdata_tocsv.m" file. Edit the code at line number 8 to include information about the path. pwd will evaluate to the present working directory (where "Triplex_Pump.prj" and other directories are stored). So, the full path will be something like "C:\Users\...\Simscape-Triplex-Pump-22.1.2.5\Workflows\Fault_Sweep\Data".
% Make data directory if it doesn't exist
if ~exist([pwd filesep 'Workflows' filesep 'Fault_Sweep' filesep 'Data'], 'dir')
mkdir('Data')
end
  • Modify the code in "sm_pump_triplex_DOEdata_tocsv.m" file at line 8 to replace the "exist" function with "isfolder" function. "isfolder" search for files or folders only on the specified path or in the current folder. Refer to these for more information on "isfolder":
% Make data directory if it doesn't exist
if ~isfolder('Data')
mkdir('Data')
end
I hope this helps!

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by