When you want to update the 'Text Area',
You can use this function. (This can be used as a history log function)
#Fucntion
%// how to call function
app.TextArea.Value = LogUpdater(app.TextArea.Value, 'Hello, World')
%// Below is the function
function [StringSet_New] = LogUpdater(StringSet_Old, Message)
if (isa(Message, 'char'))
MaxLine = 1000;
temp = StringSet_Old;
[CurMaxLine, ~] = size(temp);
%// The first line is replaced with an empty cell
if (CurMaxLine >= MaxLine)
temp(1) = [];
CurMaxLine = CurMaxLine - 1;
end
%// If this is the first line, overwrite the first line
if (CurMaxLine == 1 && isempty(temp{1, 1}))
temp{CurMaxLine, 1} = strcat(' >>', Message);
else
temp{CurMaxLine + 1, 1} = strcat(' >>', Message);
end
StringSet_New = temp;
elseif isa(Message, 'cell')
StringSet_New = [StringSet_Old; Message];
else
StringSet_New = StringSet_Old;
end
end
#Matlab
#Matlab App Designer
'Memo > Matlab' 카테고리의 다른 글
Matlab : Make & Write Data in PPT file (without PPT API) (0) | 2022.08.09 |
---|---|
Matlab function : Save and load UI values in text (0) | 2022.08.08 |
Matlab function : Update the Text Area with part of a text file (0) | 2022.08.02 |
Matlab : UI drop-down (0) | 2022.08.01 |
Matlab function : Path Checker (0) | 2022.08.01 |