How to setup MATLAB Interface for Google Cloud Storage?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 10 Sep 2024
Réponse apportée : MathWorks Support Team
le 16 Sep 2024
Hi, I am trying to setup MATLAB Interface for Google Cloud Storage using the documentation below.
https://github.com/mathworks-ref-arch/matlab-google-cloud-storage/blob/master/Documentation/README.md.
The instructions in the "Installation" and "Building" sections do not clearly specify the environment in which the commands have to be executed. Please let me know the detailed steps to configure my interface properly.
Réponse acceptée
MathWorks Support Team
le 10 Sep 2024
The instructions in the documentation are a bit unclear in specifying the environments for executing the commands. Please find the detailed steps below
1. Clone the repository locally to your machine using the following command in your system terminal
> git clone --recursive https://github.com/mathworks-ref-arch/mathworks-gcp-support.git
2. The Interface requires Java code to be built locally. You can build it using the following commands in your system terminal
> cd mathworks-gcp-support/matlab-gcp-common/Software/Java> mvn clean package
3. Follow the steps mentioned in the following document to acquire your Google Cloud Credentials in a JSON file and rename it to "credentials.json"
https://github.com/mathworks-ref-arch/matlab-google-cloud-storage/blob/master/Documentation/Authentication.md
4. To be able to use the Interface APIs without specifying the credential file explicitly every time, you can set the 'GOOGLE_APPLICATION_CREDENTIALS' Environment Variable based on your machine
a. If you are on a UNIX machine, you can set this environment variable using the following command in your system terminal
> export GOOGLE_APPLICATION_CREDENTIALS=<absolute_path_to_credentials.json># repalce <absolute_path_to_credentials.json> with the absolute path of the "credentials.json" file created in the previous step
b. If you are on a Windows machine, navigate to "Advanced System Settings" >> "Environment Variables" and add a new User Variable 'GOOGLE_APPLICATION_CREDENTIALS' with value "<absolute_path_to_credentials.json>". Make sure to replace "<absolute_path_to_credentials.json>" with the absolute path of the "credentials.json" file created in the previous step.
5. Now launch MATLAB from the root of the repository and execute the following commands in the MATLAB Command Window to initialize the interface6. You can ensure the presence of the environment variable using the following command in the MATLAB Command Window7. To check if the integration was successful, execute the following commands in the MATLAB Command Window
>> cd('mathworks-gcp-support/matlab-google-cloud-storage/Software/MATLAB')>> startup
>> getenv("GOOGLE_APPLICATION_CREDENTIALS")
>> storage = gcp.storage.Storage() % this will query the "credentials.json" file path from the environment variable% Alternatively, you can also specify the file name as an argument, and it will check for the file in the path.>> storage = gcp.storage.Storage("credentials.json")
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Software Development Tools 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!