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!