how to automatically creat sldd file based on csv file
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
wenchao zhang
el 7 de Feb. de 2024
Comentada: wenchao zhang
el 2 de Feb. de 2025 a las 12:51
i add following info to CSV file, how to use this CSV file to creat sldd file automatically.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1609996/image.png)
4 comentarios
Respuesta aceptada
Yash
el 31 de En. de 2025 a las 6:13
Hi Wenchao,
You can use the "readtable" function to read the csv. Refer to the following documentation for more details: https://www.mathworks.com/help/matlab/ref/readtable.html
Further, you can use the functions mentioned in the following article to store data programmatically in the data dictionary: https://www.mathworks.com/help/simulink/ug/store-data-in-dictionary-programmatically.html
Given below is an example code:
T = readtable("data.csv");
ddConn = Simulink.data.dictionary.open('dTmp.sldd');
ddSec = ddConn.getSection('Design Data');
for i=1:height(T)
ddSec.addEntry(T.Name{i},T.Value(i));
end
ddConn.saveChanges;
Note that if the entry with the name already exists, "addEntry" will throw error. Use "assignin" in those cases.
Hope this helps.
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Functions 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!