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)
Replacing a data column
1 次查看(过去 30 天)
显示 更早的评论
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Data Preparation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!