Replacing a data column

1 次查看(过去 30 天)
Sergio
Sergio 2013-8-28
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 个评论
Walter Roberson
Walter Roberson 2013-8-28
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)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by