MATLAB: How I set a string in edit field when string is longer than the field itself

functionguimatlab gui

Hi guys,
I have an idea how I want it to behave but I have no clue how to do it. So I beg for help 🙂
I have edit field with for exaple max. 15 char…and I have char with for example 26 char and when i put it there I want to bw shown in edit field the end of the string and to sign that some of the text is missing I want there to be '…'
In example it will be better:
edit field 15char: xxxxxxxxxxxxxxx
string 26 char: abcdefgh…xyz
and when I put the sting in the field I want it to be shown like: …opqrstuvwxyz
Thanks for replies…Peter

Best Answer

I assume you refer to an uicontrol of style: edit, text or listbox.
Idea: store the full string in UserData and truncate before you set the property, String, of the uicontrol.