Formatting column names in a table of data (2024)

37 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Batool Mutawe am 19 Nov. 2021

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data

Beantwortet: Srijith Kasaragod am 24 Nov. 2021

I have calculated values for some variables and would like to produce a table containing those values, how do I format the column/row names to show Latex text (ex. Formatting column names in a table of data (2))?

5 Kommentare

3 ältere Kommentare anzeigen3 ältere Kommentare ausblenden

KSSV am 19 Nov. 2021

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1842144

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1842144

dpb am 19 Nov. 2021

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1842814

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1842814

Bestest you can do is use unicode characters. I don't recommend doing so, but is possible.

Adam Danz am 19 Nov. 2021

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1843179

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1843179

Bearbeitet: Adam Danz am 19 Nov. 2021

In MATLAB Online öffnen

I don't think it's possible with unicode. I tried it using diacritic characters which are correctly formatted in text objects but not in table headers.

Since the run feature and local Matlab seem to use different UTF encoding, I'll use screen shots .

% produce diacritic

headerStr = char([double('A'),771,7497])

Formatting column names in a table of data (6)

% Show that it works in text objects

text(0.5,0.5,headerStr,'FontSize', 14)

Formatting column names in a table of data (7)

% Show that it is not properly formatted in table header

data = rand(5,1);

table(data,'VariableNames', {headerStr})

Formatting column names in a table of data (8)

Nevertheless, I also recommend not using this since it complicates table indexing. The losses outweight the gains.

dpb am 19 Nov. 2021

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1843304

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1843304

Bearbeitet: dpb am 23 Nov. 2021

My bad -- I was thinking of extended ASCII character set and wrote unicode instead...you're correct, @Adam Danz, nothing but single-byte characters are rendered properly as variable name strings even though (misguided, but TMW bowed to pressure) you can now have things like blanks (including leading and trailing just to make it harder)!

table documentation specifically says

"Variable names can have any Unicode® characters, including spaces and non-ASCII characters."

Peter Perkins am 23 Nov. 2021

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1849649

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#comment_1849649

Really, this is supported to allow foreign-language variable names, andvar names containing parens and dots and other punctuation. Spaces came along because it really was not clear how to sensibly draw a cutoff line. There are subtleties that are not apparent.

You are both correct that arbitrary var names are a double-edged sword.

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Antworten (1)

Srijith Kasaragod am 24 Nov. 2021

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#answer_839169

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/1590624-formatting-column-names-in-a-table-of-data#answer_839169

Hi Batool,

I assume you wish to name table variables as LATEX text and display the table in command window. MATLAB supports LATEX text in charting, annotations and publishing outputs. In such instances, the LATEX expressions will be interpreted as LATEX text and displayed appropriately. Command window does not render LATEX expressions and cannot be used to display publishable output. Instead the variable name would be displayed as the quoted LATEX expression.

Hope this helps!

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

MATLABData Import and AnalysisData Import and ExportStandard File FormatsLaTeX

Mehr zu LaTeX finden Sie in Help Center und File Exchange

Tags

  • table
  • latex

Produkte

  • MATLAB

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by Formatting column names in a table of data (12)

Formatting column names in a table of data (13)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

Kontakt zu Ihrer lokalen Niederlassung

Formatting column names in a table of data (2024)

References

Top Articles
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5786

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.