How to open a .psprj file directly from the command-line?

13 visualizaciones (últimos 30 días)
Peter Bauer
Peter Bauer el 6 de Mayo de 2020
Comentada: Peter Bauer el 11 de Mayo de 2020
Hi,
i am trying to implement a script wich performs all required steps to generate a .psprj file and finally starts the Polyspace GUI application so the user can immediately run the analysis and view the results. Therefore i would like to pass on the path to the .psprj to the polyspace.exe.
polyspace.exe <myfile>.psprj
Does not work as there is just a Java process and the polyspace process running in the background and consuming lots of CPU cycles but the GUI never appears.
Is this possible somehow?
thank you,
Peter

Respuesta aceptada

Anirban
Anirban el 7 de Mayo de 2020
Hi Peter,
The command should have worked. But can you try the following:
polyspace.exe -cfg <myfile>.psprj
An even better alternative might be to generate the launching script, so that the user has to just double-click a batch file in Windows to run (or use a Shell script in Linux). The official instructions are documented here.
  3 comentarios
Anirban
Anirban el 8 de Mayo de 2020
Editada: Anirban el 8 de Mayo de 2020
Hi Peter,
I confirmed on my side that with or without the -cfg flag, the GUI is able to open a psrpj file (without the analysis having been run previously). I used the latest release, R2020a. Knowing the release number you are using will help, but I think at this point, MathWorks Technical Support can assist you better. They can look at your system, your specific installation and the specific project you are trying to open. The GUI not opening might be a symptom of something else. Starting the GUI does not cause the analysis to run. Starting the analysis has to be explicitly done, as far as I know.
Either way, at least, looks like we have a start. You can run the analysis once and then hand off the project to the user. To fine-tune options, you would have to run a first analysis anyway and make sure you are seeing expected results. But in the long run, someone should investigate further what is preventing the GUI from opening. Technical Support is in the best position to help.
With the script, the idea is: you generate the batch file or shell script from a project using the option -generate-launching-script-for (documented in the link above). At that point, the original project is no longer required. The batch file or shell script will refer to an options file options_command.txt, which extracts all necessary information from the project (the file options_command.txt itself refers to another file sources_list_file.txt for the sources but that is a detail). A user can now simply use that script as is to run the analysis and after analysis, open the results file (.psbf or .pscp) with the command:
polyspace.exe <myFile.psbf>
But the more I think, I have a feeling the workflow you are envisioning would suit you slightly better. I am guessing that you will provide the project to another user who will not have the source files on the exact same path as yours (or submit to a version control system). The Polyspace project has a nice convenience that if the root path of the project changes, all source file paths are recalculated relative to the new root path (making it very suitable for a version control system). See more details in this MATLAB Answers post. With the script idea I gave, the script has to be adapted each time the location of the sources change. But the adapting required is not too difficult (all instances of the root path needs replacing). So, the script idea might also work for you.
Peter Bauer
Peter Bauer el 11 de Mayo de 2020
I am using version R2019b.
I digged a little deeper and also tried it on other machines with the same version installed, same result there: it does not work with the .psprj file generated by polyspace-configure but when opening it with the GUI and starting the analysis, the .psprj file is changed a lot and can then also be opened directly from the command-line.
Thank you for the suggestion, i already contacted the technical support, hopefully this will be solved somehow.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by