about edit text string getter

i write a GUI program, all works in R2017a,but i most run that in a window xp and R2014a, i test application complier, and showed error "not a valid win32 application"
i start debug program in r2014a and one of bug didn't solved.
i have some button, pupupmenu and a edit text,
in edit text i used below code
handles.setting.edit1(handles.pushbuttonno,:)=string(get(handles.edit1,'string'));
%pushbuttonno is a counter from 1 to 372 and work with a if circle
%handles.pushbuttonno,: its used for locate a cell like 1,1 or 100,1
then i used a xlswrite
xlswrite(experiment.xls,cellstr(handles.setting.edit1),experiment,'c2')
its a GUI program and show a rgb code as figure to user and take some data each time and collect all data to "handles.setting,edit" and then most write in excel file.
a dimension error all time is showed

2 commentaires

Rik
Rik le 1 Sep 2020
The string data type was introduces in R2016b. If you want to use an old release it is on you to check if all functions exist and write workarounds or replacements if they don't, just like I do in functions like regexp_outkeys.
mehrdad jafari
mehrdad jafari le 1 Sep 2020
tnx man, i will try!
i use of another system tomorow

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 2 Sep 2020

0 votes

Probably
handles.setting.edit1(handles.pushbuttonno,:) = cellstr(get(handles.edit1,'string'));
xlswrite(experiment.xls, handles.setting.edit1, experiment, 'c2')
Your code already assumes that every time through, edit1 has the same number of entries in its String property. Your existing code can handle the case where the edit1.String property is a single character vector, but it can also handle the case where edit1.String is cell array of character vectors (it would have to be a scalar cell array unless edit1.Max > 1, which your code is already compatible with.)
More obscurely, your existing code is compatible with the possibility that each time, edit1.String is either a cell array of character vectors of consistent (non-scalar) length or that edit1.String is a character vector or edit1.String is a scalar cell array of character vector. In this one case of inconsistent sizes, the character vector or scalar cell array of character vectors would be copied to all of the columns.
The code I post here copies all of those behaviours, including the ones that are probably not desired.

Catégories

En savoir plus sur Characters and Strings dans Centre d'aide et File Exchange

Produits

Version

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by