Replacing a data column
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a text file with numbers and strings. The data file can be open as a text https://docs.google.com/file/d/0B8J61M3OVizFTy1FcGQyVUxxMEk/edit?usp=sharing
I want to replace the 6th column (width) by width*2, for example. Not that the file contains many tables with different dimensions. This represent inputs to different modules in a software I'm using. My goal is to import the data arrays I want to edit which I've accomplished with the following code
fid=fopen('C:\Users\sdehoyos\Documents\Matlab Work\automating\Accotink_2and10yr_New_node_convention_2.inp'); textData=textscan(fid,'%s%d%s%f%f%f%f%f',417,'headerlines',46,'delimiter','\t'); fclose(fid); a=textData{1,6}*2;
what I need now is to save the test file with another name (another case scenario) and with the corresponding column replaced. I need to do this many times. I think fprint would be the function put dont know how to do it.
Thank you in advance.
SDH
1 Commento
Walter Roberson
il 28 Ago 2013
If you are on Linux or OS-X you would probably find it easier to code in awk or gawk. Or, on any OS, code in perl. (Note: perl is standard in Linux and OS-X and is included with MATLAB on MS Windows)
Risposte (0)
Vedere anche
Categorie
Scopri di più su Text Data Preparation in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!