To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
Dear users, I have a 3200x9 matrix and there are different types of number forms inside of it. Some of rows are given below.
Fe 26 4.96742E+006 6.7785E+008 -3.0933E+007 -5.291E+007 0.0062407 0.0004310 0.0002620
I want to rewrite these datas into a text file in formatted form such that:
|.|.|.|.|.| |.|.| *|*|*|*|*|*|*|*|*|*|*| |F|e| | | | |2|6| |4|.|9|6|7|4|2|E|6| | |6|.|7|7|8|5|E|8| |-|3|.|0|9|3|3|E|7|
5 digit 3 digit 10 digit 10 digit 10 digit \ 1st data / \2nd data/ \3rd data/ \4th data/ \5th data/
First and second columns must be written in 5 and in 3 digits, and others must be written in 10 digits that is 10 digits should be between end-to-end that is included '-' sign and roundeds etc if necessary. I used the following commands but I couldn't be able to do that:
l=size(COLLISION); fid=fopen('DATA.txt','wt') for i=1:l(:,1); fprintf(fid,'Fe %d %7.5E %7.4E %7.4E %7.3E %.7f %.7f %.7f \n',COLLISION(i,2),COLLISION(i,3),COLLISION(i,4),COLLISION(i,5),COLLISION(i,6),COLLISION(i,7),COLLISION(i,8),COLLISION(i,9)); end fclose(fid)
which the COLLISION is the name of matrix.
Attached file is the result of above commands. Thank you
No products are associated with this question.