import value from text file
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i have a .ini file that has variables in it, and i want to import them into matlab and assign them the same variable. the ini file looks like this:
a1=-108
a4=10
a5=0.014
a6=-0.24
etc.
so i want to be able to make a1=-108 in matlab. there are hundreds of variables so i dont want to have a formula for each.
0 comentarios
Respuestas (1)
TAB
el 23 de Ag. de 2012
Editada: TAB
el 23 de Ag. de 2012
fid = fopen('YourFile.txt');
data = textscan(fid,'%s','delimiter','\n');
cellfun(@eval,data{1});
fclose(fid);
3 comentarios
TAB
el 23 de Ag. de 2012
Soory, I didn't got your concern ?
Above code will created variables a1, a2...etc with values specified in the text file.
Ver también
Categorías
Más información sobre Workspace Variables and MAT Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!