Help with code to convert Simbiology sbproj file into gPKPDSim session file in .mat format
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
CLang
am 26 Okt. 2018
Beantwortet: Iraj Hosseini
am 5 Nov. 2018
I'm trying to learn gPKPDSim and it seems my first step is to create a project file in Simbiology that will subsequently be changed into .mat format to load as a session file into gPKPDSim. Dr. Hosseini states in his paper "gPKPDSim: a SimBiology-based GUI application for PKPD modeling in drug development" that a program he provides called "Configuration.m" will make this conversation. I found the code for the "Configuration.m" file but am getting errors, probably due to my lack of knowledge of Matlab.
After I clear the screen, I enter "Analysis = PKPD.Analysis;", which works. I'm next supposed to enter "PathName = fileparts(which(mfilename));" so I enter
PathName = fileparts(which('C:\Users\langston\Documents\Research\Pharmacokinetics\gPKPDSim\PPG Swine mean SD.sbproj'));
While no error is created, the variable PathName returns "0×0 empty char array", which I presume means it is empty. This impacts the subsequent code to produce an error. When I enter
exist 'C:\Users\langston\Documents\Research\Pharmacokinetics\gPKPDSim\PPG Swine mean SD.sbproj'
I get an answer of 2, so I presume the file is there. I hate to ask such a simple question but what do I have wrong in the syntax?
Thanks
0 Kommentare
Akzeptierte Antwort
Arthur Goldsipe
am 29 Okt. 2018
Ah, I finally figured out what's going on. The function "which" can only be used to locate files that are in the current working directory or on the MATLAB path. So if you "cd" into your gPKPDSim directory (or add it to your MATLAB path) and then run the command, then you should see that PathName is not empty.
However, that's probably not even necessary. If you are hard-coding the path, then you can just replace the line of code with the directory, that is:
PathName = 'C:\Users\langston\Documents\Research\Pharmacokinetics\gPKPDSim\';
But I think the intent of the code is that you don't have to replace "mfilename". mfilename is actually a MATLAB function that returns the name of the file that is currently running. So this allows the configuration file to programmatically determine the file path without you having to type it into the file.
Hopefully that solves your problem this time around.
-Arthur
Weitere Antworten (6)
Arthur Goldsipe
am 26 Okt. 2018
See if your problem is fixed by using two slashes when you define PathName. That is, change the line of code to the following:
PathName = fileparts(which('C:\\Users\\langston\\Documents\\Research\\Pharmacokinetics\\gPKPDSim\\PPG Swine mean SD.sbproj'));
The reason you didn't have to do this with exist is because you invoked it as a "command" rather than as a "function". (For more details, you can read this blog post .) You would have to do the same thing if you invoked it this way:
exist('C:\\Users\\langston\\Documents\\Research\\Pharmacokinetics\\gPKPDSim\\PPG Swine mean SD.sbproj');
0 Kommentare
CLang
am 27 Okt. 2018
1 Kommentar
Arthur Goldsipe
am 27 Okt. 2018
Sorry, I was wrong. I think double backslashes are only needed when calling functions like sprintf or fprintf. I'll take a closer look again later.
CLang
am 29 Okt. 2018
1 Kommentar
Arthur Goldsipe
am 29 Okt. 2018
importModel is a method that's defined in gPKPDSim. Normally, this error indicates is caused by a typo in the file name or path.
Do you get the same error message if you try the following at the MATLAB command prompt?
sbioloadproject('C:\Users\langston\Documents\Research\Pharmacokinetics\gPKPDSim\models\PPG Swine
mean SD.sbproj')
I think that's the command that importModel is running, so I would expect it to error to error here, too. If this command also errors, can you confirm that the following also errors?
exist('C:\Users\langston\Documents\Research\Pharmacokinetics\gPKPDSim\models\PPG Swine
mean SD.sbproj')
I thought you wrote earlier that this command returned 2. But then I wouldn't expect sbioloadproject to error. So something doesn't add up.
What version of MATLAB are you using? I'd like to confirm I'm using the same one. It might also be helpful to include the output of the "ver" command.
CLang
am 29 Okt. 2018
1 Kommentar
Arthur Goldsipe
am 30 Okt. 2018
Bearbeitet: Arthur Goldsipe
am 30 Okt. 2018
It took me a while to see the difference, but the two paths are not the same. Note that the failing commands contain a "models" subfolder, which is not correct. Try removing the "models" part of the ProjectPath code:
ProjectPath = fullfile(PathName,'PPG Swine mean SD.sbproj');
Iraj Hosseini
am 5 Nov. 2018
Hi
To learn gPKPDSim, you can also use the SimBiology models and corresponding session files that we have provided as supplements with the paper. For the config file, we have provided a template that you can modify for your SimBiology model and build the session file.
To run a config file, you need to make sure that the appropriate gPKPDSim folders have been added to PATH. To do so, please run the app and close it. This makes sure all the required folders are setup correctly in Matlab PATH. Then run the config file.
Thanks, Iraj
0 Kommentare
Communitys
Weitere Antworten in SimBiology Community
Siehe auch
Kategorien
Mehr zu Biotech and Pharmaceutical 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!