How to display the contents of a cell in a messagebox

4 vues (au cours des 30 derniers jours)
Mats de Jong
Mats de Jong le 10 Oct 2019
Commenté : Adam Danz le 11 Oct 2019
I have a 6x1 cell variable with name 'Compounds' containing the six names of identified substances is an analyzed sample. My Question now is how I can let these names pop up in a messagebox. I know I can use the msgbox function, but I can't get it to work with the cell variable. Anyone who can help me out?

Réponse acceptée

Adam Danz
Adam Danz le 11 Oct 2019
Modifié(e) : Adam Danz le 11 Oct 2019
compounds = {'CaCO3','CO2','CuSO4','C6H12O6','HCI','NaCl'};
msg = msgbox(['Compounds: ', strjoin(compounds,', ')],'title')
If you want subscripts,
compounds = {'CaCO_3','CO_2','CuSO_4','C_6H_1_2O_6','HCI','NaCl'};
createMode.WindowStyle = 'non-modal';
createMode.Interpreter = 'tex';
msg = msgbox(['Compounds: ', strjoin(compounds,', ')],'title',createMode)
191010 205448-title.png
  2 commentaires
Mats de Jong
Mats de Jong le 11 Oct 2019
Thank you very much Adam! I was lacking the strjoin part. Works perfectly now.
Adam Danz
Adam Danz le 11 Oct 2019
Glad I could help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Produits


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by