Get "@" back in a table header (R2017b) when saving

조회 수: 1 (최근 30일)
JM
JM 2021년 2월 23일
답변: JM 2021년 2월 26일
I have got a tabulated data-set which contains "@" in its coloum header (e.g name@domain). When loading this table in Matlab (R2017b) this header gets replaced by name_domain.
I need to do some post-processing on the data and the need the correct header back (i.e. with "@") in the final post processed data when saved as ascii file.
How to achive this in Matlab R2017b?

답변 (2개)

Matt J
Matt J 2021년 2월 23일
편집: Matt J 2021년 2월 23일
For example,
T=table(1,'VariableNames',"name_domain")
T = table
name_domain ___________ 1
T.Properties.VariableNames = replace(T.Properties.VariableNames,'_','@')
T = table
name@domain ___________ 1
  댓글 수: 12
JM
JM 2021년 2월 25일
Thanks, but it appears writemode is not available in R2017b.
Walter Roberson
Walter Roberson 2021년 2월 25일
To be honest, the easiest way would be to upgrade MATLAB releases.
Second easiest way, if you are using MS Windows, would be to generate two seperate files, and then use
system(sprintf('copy "%s"+"%s" "%s"', first_tempfile, second_tempfile, desired_file))
The third easiest way would be to fopen() the file and fprintf() a line at a time, using appropriate formatting.

댓글을 달려면 로그인하십시오.


JM
JM 2021년 2월 26일
Thanks for all the answers. Upgrading seems the best way out of this but that is not going to happen any time soon.

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by