How to replace multiple strings in a txt file
Mostra commenti meno recenti
Hi,
I would like to couple matlab to a another program so I can make a lot of models in a fast way. To do so, I need a txt file with commands in which I can modify some strings with Matlab. For example, in the txt file the commands are written...
*add_points
3
0
x1
0
0
x2
5
0
3
5
0
*set_curve_type line
*add_curves
50
49
49
52
52
51
*set_curve_type fillet
*add_curves
23
24
x3
..... and the idea is to replace x1,x2 and x3 with the values from A in which A is a 10*3 matrix and x1=A(1,:) and x2=(2,:) and x3=A(3,:).
So I have 10 text files to make the 10 models.
My question is: how to do this? I tried to use commands as txtscan, strrep but that didn't work for me...
Any suggestions? What would be the most easy way?
Thanks in advance!
Steven
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!