Multiple Files into Multiple Variables
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, Beginner again trying to handle files. I've got a folder with >250 files in it (csv files, 100x150 each), filled with doubles between 0 and 1. What I'm looking to do is to read each of these files into the workspace, and store as a variable with the filename as the variable - to make it easier, they have been output using Matlab, and output from a loop with:
csvwrite([num2str(FolderName) '/GL' num2str(FileNameGL) ' Amplitude'],Amplitude); % Writes the Pixel Values into CSV File
The variable FileNameGL above is grey-level values which change from 0-255, and the csv is output with this in the name.
I'd like to read this file in again, within another script, assigning it to a variable, for example, GL#_amp, where # will increment and reflect the grey-level of the filename. NOTE that the grey-levels are not related to those in the file, they are essentially just file numbers. Summary: how to set a variable in workspace as a read-in-file, then set a new variable with a new file, and repeat as many times as required... I know I could use variable as an individual cell in a variable, but is there a way to set as separate variables?
Thanks all.
0 件のコメント
回答 (2 件)
Steven Lord
2015 年 7 月 8 日
You can do what you are trying to do, but DON'T. Use the techniques described in question 1 in the Programming section of the FAQ instead of trying to create individual variables.
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!