Matlab textArea automatic new line issue
Mostra commenti meno recenti
I'm trying to generate a list of items. For each research cruise, its Year, Month, Day, Longitude, Latitude, etc. should all be in one row. Here is my code:
% generate the cruise list:
app.textArea.Value = '';
AA = [];
for i = 1:numel(cruiseList)
Ind1 = VAR(:,6) == cruiseList(i);
if sum(Ind1)>0
AA = [AA, 'Cruise #', num2str(cruiseList(i)), ', Year: ', ...
Sta{Ind1}.year, ', Month: ', Sta{Ind1}.month, '.'];
end
end
app.textArea.Value = AA;
Here is the problem. The generated information are not all in a row. Instead, they are break into many rows like the below:
Cruise #
1
, Year:
2015
, Month:
10
.
Instead of the desired format of
Cruise #1, Year: 2015, Month: 10.
...
Why is Matlab automatically adding newlines? How should I fix this issue?
Many thanks.
Risposta accettata
Più risposte (1)
Asvin Kumar
il 16 Mar 2021
0 voti
If that doesn't solve it, you could try a couple of things:
- Set a breakpoint at the line where you set the TextArea's Value. Verify whether AA is a character vector without newlines.
- If you suspect that newlines are getting added later, try using sprintf to construct the string which you want to assign to TextArea. Example on using sprintf is here.
1 Commento
Leon
il 16 Mar 2021
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!