Disp() is not showing the whole sentence in the command window
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Zeynab Mousavikhamene
am 29 Okt. 2019
Kommentiert: the cyclist
am 29 Okt. 2019
I used disp() fucntion to show warning on the command window. Apparently, the sentence is longer than one line so it is not showing it completely in the command window. How can I mangae this?
note=['warning: the value of parameter taken from foldre name is not consisitant with json parameter value',param_table.name(jjj) ];
disp(note)
Output:
'warning: the value of parameter taken from fold…' 'DEATH_AGE_AVG'
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 29 Okt. 2019
Bearbeitet: Steven Lord
am 29 Okt. 2019
Your param_table is likely a struct whose name field contains a cell array.
>> jjj = 1;
>> param_table.name{1} = 'DEATH_AGE_AVG';
>> note=['warning: the value of parameter taken from foldre name is not ', ...
'consisitant with json parameter value', param_table.name(jjj) ];
>> disp(note)
Because of this, note is a 1-by-2 cell array and when displaying cell arrays with disp only a certain portion of each cell is displayed. Otherwise one cell with a large amount of text could scroll the display of other cells off the top of the Command Window's scroll buffer.
You can avoid this by making note a char vector. Extract the contents of the cell stored in the name field rather than the cell itself. Note that I used {} instead of () to extract the data from param_table.name when I constructed note.
>> jjj = 1;
>> param_table.name{1} = 'DEATH_AGE_AVG';
>> note=['warning: the value of parameter taken from foldre name is not ', ...
'consisitant with json parameter value', param_table.name{jjj} ];
>> disp(note)
1 Kommentar
Weitere Antworten (1)
the cyclist
am 29 Okt. 2019
Did you use square or curly brackets when you defined "note"?
Square brackets will concatenate the two strings, and should display everything. Curly brackets will define a cell array of two strings, and truncate the display.
note_curly = {'warning: the value of parameter taken from foldre name is not consisitant with json parameter value','DEATH_AGE_AVG'};
note_square = ['warning: the value of parameter taken from foldre name is not consisitant with json parameter value','DEATH_AGE_AVG'];
disp(note_curly)
disp(note_square)
The code you posted had square brackets, but the output is what I would expect from curly.
0 Kommentare
Siehe auch
Kategorien
Mehr zu JSON Format finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!