Programming with fprintf

I am writing a number of functions where I want to write a substantial amount of text and computational results to the screen and possibly to one or more text files. The way to do this certainly appears to be with fprintf, but there is one enduring problem - finding some way to conveniently edit the fprintf statements as the program changes. I've tried using one fprintf per line and that becomes a nightmare very quickly. I've tried using one fprintf with many %s specifiers and all the lines of text as arguments. That works OK if the number of lines is not too large, AND the number of numeric arguments is small. But I mostly have many, many lines with nearly as many data values mixed in.
Suggestions for good ways of dealing with this are very welcome

1 Comment

You might want to give us an example of the kind of output you'd like to generate (first 20 lines or so to start). I'm having some difficulty imagining possible solutions without a little more information.

Answers (0)

This question is closed.

Products

Asked:

on 10 Feb 2012

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!