How to setup MATLAB Interface for Google Cloud Storage?
6 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2024 年 9 月 10 日
回答済み: MathWorks Support Team
2024 年 9 月 16 日
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.
採用された回答
MathWorks Support Team
2024 年 9 月 10 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Software Development Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!