Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MATLAB varying no of variable reading

Status
Not open for further replies.

arve9066

Member level 2
Joined
Jan 21, 2016
Messages
48
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
446
I have a mat file that contains variables named deterministically like a1_1,a1_2,a1_3.... a1_n.. n is variable depending on the mat file I read, but the naming convention remains the same. I need to read all of these in a loop that goes from 1 to n. What is the best way to achieve this?
 

If you just do "load filename" doesn't it bring in all those variables?
 

I mean once I load the file in to matlab, how to access those variables in a loop if I know 'n'.
 

Not sure you can do that. You could load them into an array and access them that way.
 

Ok.. Actually I am running another m file to create those mat files. Is there a different way I can save those variables to the mat files which will help me access these in the way I described earlier. My program does this - I have a varying number of input files which needs to be processed. Each file is processed by an m file to get a set of variables corresponding to that input file which I save in to a mat file. I do the same for all these input files and append the variables to the same mat file. Once I have all these files processed, I work with the mat file to further process the data.
 

use the variables and do not clear the memory, keep the variable name different in every mat file, and use the values in multiple mat files.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top