MATLABからAW​Sにテキストファイル​を送信したい

1 visualización (últimos 30 días)
ryota arai
ryota arai el 23 de Jul. de 2020
Comentada: Kojiro Saito el 5 de Ag. de 2020
MATLABからAWSのAmazonS3にテキストファイルを送信したいと考えています.
AWSでアクセスキー,アクセスシークレットキーを発行し,MATLABのコードに入力し,
上記のサイトをもとに通信しようと考えたのですが,うまくいきません.
そもそもこのサイトが通信するために必要なページなのかも分からなくなってきました.
もし,通信した経験がある方やノウハウをご存じの方がいらっしゃったら教えていただきたいです.
よろしくお願いいたします.
  2 comentarios
Kojiro Saito
Kojiro Saito el 27 de Jul. de 2020
S3からのデータ読み書きを行うには、上記のドキュメントでの設定が必要になります。
MATLABでどのようなコマンドを実行してどのようなエラーが出ているか、S3に関する部分だけでも抜粋してお教えいただくことはできますでしょうか?
ryota arai
ryota arai el 27 de Jul. de 2020
コードは以下です.
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
filename = 'C:\Users\wellness_root\Downloads\test1.txt';
setenv('AWS_ACCESS_KEY_ID', '-----------------');
setenv('AWS_SECRET_ACCESS_KEY', '------------------------------');
% ds = tabularTextDatastore('s3://wellness1resized/test.txt');
ds = tabularTextDatastore('s3://buckets/wellness1resized/test1/','TreatAsMissing', 'NA', 'SelectedVariableNames', {'ArrDelay'});
tt = ds;
tt = sortrows(rmmissing(tt));
write('s3://wellness1resized/test3/',tt);
% ↑データを書き込むフォルダの指定(空または存在しないフォルダーでなければならない)
% データを読み戻すには、関数 datastore を使用
ds = datastore('s3://wellness1resized/test3');
% ↑AWSに書き込み先とファイル名の指定
tt = tall(ds);
ーーーーーーーーーーーーーーーーーーーーーーーーーーーー
S3にフォルダの作成は出来ているのですが,S3にテキストファイルを送ることが出来ません.
他に調べても全く実現出来そうなヒントなどが見つかりません.よろしくお願いいたします.

Iniciar sesión para comentar.

Respuesta aceptada

Kojiro Saito
Kojiro Saito el 30 de Jul. de 2020
関数writeはtall配列を書き込む関数で、datastoreを直接書き込むことができません。
tt = ds;
のところを
tt = tall(ds);
にすればS3にファイルが書き込まれると思います。
  4 comentarios
ryota arai
ryota arai el 4 de Ag. de 2020
S3に書き込めました!ありがとうございます!!
Kojiro Saito
Kojiro Saito el 5 de Ag. de 2020
良かったです。もしよろしければ回答の採用をしていただけると幸いです。

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB 入門 en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!