Get "@" back in a table header (R2017b) when saving
    2 views (last 30 days)
  
       Show older comments
    
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?
0 Comments
Answers (2)
  Matt J
      
      
 on 23 Feb 2021
        
      Edited: Matt J
      
      
 on 23 Feb 2021
  
      For example,
T=table(1,'VariableNames',"name_domain")
T.Properties.VariableNames = replace(T.Properties.VariableNames,'_','@')
12 Comments
  Walter Roberson
      
      
 on 25 Feb 2021
				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.
See Also
Categories
				Find more on Text Data Preparation in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

