How to display the contents of a cell in a messagebox

조회 수: 4 (최근 30일)
Mats de Jong
Mats de Jong 2019년 10월 10일
댓글: Adam Danz 2019년 10월 11일
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?

채택된 답변

Adam Danz
Adam Danz 2019년 10월 11일
편집: Adam Danz 2019년 10월 11일
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
Mats de Jong
Mats de Jong 2019년 10월 11일
Thank you very much Adam! I was lacking the strjoin part. Works perfectly now.
Adam Danz
Adam Danz 2019년 10월 11일
Glad I could help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by