• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 869
  • Last Modified:

FORTRAN77 format statement to MATLAB format statement

Right now I`m doing FORTRAN77 to MATLAB conversion. I get confused with  FORTRAN77 format statement under WRITE Syntax.

"  ``1H '' (note the blank after the H)
When writing, this means that one character, namely the blank, is to be inserted into the line being built up for despatch to the lineprinter."

Can anyone show me how to write in MATLAB using FPRINTF syntax?
Example:
FORTRAN code--------- >    write(1,'(1h,i5,F12.8)') a,b
MATLAB code----------->     fprintf (fid1,'?????',a,b);
0
zappelin_245
Asked:
zappelin_245
1 Solution
 
yuk99Commented:
This fortran code uses obsolete Hollerith constant format (1H ) in write statement to deal with string characters.  Since Matlab fully supports strings you don't have to worry about it.
fprintf(fid1,' ')

or
a=' '; % space character
fprintf(fid1,'%c',a)

Use %s instead of %c in case of many characters in a.
0
 
zappelin_245Author Commented:
Thank you very much!!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now