I have a cellArray data and I extracted the first column of this cellArray. In another function when I call this data with global this data looks empty.

2 vues (au cours des 30 derniers jours)
function pushbutton1_Callback(hObject, eventdata, handles)
.............
cellArray=
' 334 4261461.0645 2661117.6797 3918916.0472'
' 352 4266205.852 2659683.96 3914798.2885'
' 404 4258400.8221 2662966.354 3920634.872'
out1 = regexp(cellArray,'(?<=^\s*)\d*','match')
out1= cat(1,out1{:})
function pushbutton2_Callback(hObject, eventdata, handles)
global out1
%when I call out1 it looks []. It should look
'334'
'352'
'404'
what is the problem?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 9 Juil 2013
Avoid global, you can use for example guidata
function pushbutton1_Callback(hObject, eventdata, handles)
handles.out1=out1
guidata(handles,hObject)
In the second pushbutton
function pushbutton2_Callback(hObject, eventdata, handles)
out1=handles.out1

Plus de réponses (1)

dpb
dpb le 9 Juil 2013
I see no GLOBAL in pushbutton1_Callback where out1 is defined. And, of course, even if there were, it has to have been executed first.

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by