MATLAB: Variable into msgbox??

charmsgboxvariables

How do I display a variable's value on a msgbox? I have (1×9) array :
k =
Columns 1 through 7
[1x27 char] [1x36 char] [1x35 char] [1x32 char] [1x28 char] [1x27 char] [1x34 char]
Columns 8 through 9
[1x23 char] [1x34 char]
I try that but it didn't work:
>> msgbox(['These values are incorrect', 'WARNING','warn'], k)
??? Error using ==> figure Value must be a string
Error in ==> dialog at 88 hDialog = figure('BackingStore' ,backstore , …
Error in ==> msgbox at 223 figureHandle=dialog( …
Can you help me??

Best Answer

The 2nd input of MSGBOX is a string containing the dialog's title. See "help msgbox".
msgbox(cat(2, {'These values are incorrect:'}, k), 'Warning')
The CAT command joins the single cell string with the list of strings in the cell string k to create the message.