Print Table to a File.

4 vues (au cours des 30 derniers jours)
Pappu Murthy
Pappu Murthy le 20 Mai 2018
Commenté : Pappu Murthy le 24 Mai 2018
I have this code
VarNames={'Col1', 'Col2'};
RowNames={'Row1', 'Row2'};
A = [1 2;3 5];
Ta = array2table(A,'VariableNames',VarNames,'RowNames',RowNames)
When I execute this i get table printed properly formatted but on to a screen.
I like similar tables one after other several of them, to a file properly formatted every time.
all tables are of equal size. I tried writetable but that does not seem to be the answer.
How do I do it? Thanks in advance.
  2 commentaires
Walter Roberson
Walter Roberson le 20 Mai 2018
What does "properly formatted" mean to you?
Pappu Murthy
Pappu Murthy le 20 Mai 2018
Modifié(e) : Pappu Murthy le 20 Mai 2018
For e.g Ta =
Col1 Col2
____ ____
Row1 1 2
Row2 3 5

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 20 Mai 2018
Try fopen(), fprintf(), and fclose(). With those three functions you can make it look exactly how you want it to look.
  2 commentaires
Walter Roberson
Walter Roberson le 21 Mai 2018
Make sure you use width specifications on all of your % formats, to get everything lined up the way you want.
Pappu Murthy
Pappu Murthy le 24 Mai 2018
Got it. thanks guys.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by