アプリケーションコンパイラー→パッケージ化→アプリケーションソフト(.exe)を起動してもエラーが発生
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
下記内容でAAA(添付zipファイル参照)のフォルダをリスト化し、リストしたテキストデータをcsvに落とすアプリケーションを作りたいです。ライブスクリプトでは問題なく動きますが、アプリケーションコンパイラー→パッケージ化→アプリケーションソフト(.exe)で作ったアプリケーションソフトを起動すると「'1.txt'が見つかりません。・・・」とエラーがでます。
対処方法を教えていただけないでしょうか。よろしくお願いします。
List = dir('AAA/*.txt')
for n = 1:length(List)
List1{n} = readcell(List(n).name)
List2 = cat(1,List1{1:n})
end
writecell(List2,"List.csv")
0 commentaires
Réponse acceptée
Kojiro Saito
le 24 Sep 2021
List(n).nameにはファイル名(例:1.txt)しか含まれませんので、exeファイルと同じフォルダ階層に1.txtと2.txtが置かれている必要があります。
AAAフォルダに1.txtなどがあるとのことなので、fullfileを付けてフォルダ名を含むファイルパスを指定してみてはいかがでしょうか?
List = dir('AAA/*.txt')
for n = 1:length(List)
List1{n} = readcell(fullfile(List(n).folder, List(n).name))
List2 = cat(1,List1{1:n})
end
writecell(List2,"List.csv")
また、アプリケーションコンパイラでexeにした後、exeと同じフォルダにAAAを置く必要があります。
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Application Deployment 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!