FORTRAN77 format statement to MATLAB format statement

Posted on 2009-12-21
Last Modified: 2016-02-10
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?
FORTRAN code--------- >    write(1,'(1h,i5,F12.8)') a,b
MATLAB code----------->     fprintf (fid1,'?????',a,b);
Question by:zappelin_245
    LVL 15

    Accepted Solution

    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,' ')

    a=' '; % space character

    Use %s instead of %c in case of many characters in a.

    Author Closing Comment

    Thank you very much!!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now