MATLAB: Importing Data Using Function

bad ideaimportimport dataimport function

Hello,
I have a set of data, each file is in .spe format. The function readSPE reads these files and outputs a 3D array.
I would like to write a script which would convert each of the .spe files to a 3D array with variable name = file name.
Please help! Thanks 🙂

Best Answer

Why do you want to do this unwise thing?
How can you then have code that operates on that array if you don't know what the array will be called until runtime when the data file has been loaded?
I'd recommend you just call it data3d or something and not complicate things by having the variable have a name that changes depending on what data file you read in.