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 Center および File ExchangeText Data Preparation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by