フィルターのクリア

Loop Through Files to Import

2 ビュー (過去 30 日間)
Anas Khan
Anas Khan 2021 年 4 月 10 日
コメント済み: Anas Khan 2021 年 4 月 11 日
I have data stored in files as seen in the screenshot attached. I want to create a script that will automatically access each file and load it into the workspace with the same name as the filename. I'll be using fopen() and fread() to access and read in each individual file. There are other file types in the folder that I do not want to import (the png and .m files). Any help would be appreciated.
  2 件のコメント
Stephen23
Stephen23 2021 年 4 月 11 日
I strongly recommend that you change your OS settings to show file extensions:
Otherwise working with files is confusing and more complex.
Anas Khan
Anas Khan 2021 年 4 月 11 日
Thank you so much! Yes I was wondering how to figure out what the file extensions were for these. Was pretty disappointed when properties didn’t tell me.

サインインしてコメントする。

採用された回答

Jan
Jan 2021 年 4 月 10 日
"with the same name as the filename" - This is a bad idea. Prefer to use either the same name or an array. Creating variables dynamically with names determined at runtime are a shot in your knee. See: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by