Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Reading file delivery problem

조회 수: 2 (최근 30일)
han han
han han 2019년 11월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
I want the .txt message ([Nodelocation]) read by pushbutton2 to be used on pushbutton1, but pushbutton1 can't read the data of pushbutton2. How do I write it?
function pushbutton2_Callback(hObject, eventdata, handles)
[file,filepath] = uigetfile('*.txt');
if isempty(file); return; end %user cancel
fullname = fullfile(filepath, file);
[Nodelocation] = textread(fullname);
% --- Executes on button press in Topology.
function pushbutton1_Callback(hObject, eventdata, handles)
[UElocation] = textread('observe/mdUELocationforGUI2.txt');
[AssignCell] = textread('observe/AssignCell.txt');
cla(handles.axes1,'reset');
axes(handles.axes1);
for ii=1:length(Nodelocation(:,1))
for jj=1:length(UElocation(:,1))
if AssignCell(jj,2) == Nodelocation(ii,1)
if Nodelocation(ii,1) == 0
scatter(Nodelocation(ii,2),Nodelocation(ii,3),150,[1 0 0],'^','filled');
hold on;
scatter(UElocation(jj,2),UElocation(jj,3),50,[1 0 0],'x');
hold on;
end
end
end
end

답변 (1개)

Rik
Rik 2019년 11월 19일
Store the result back to your guidata struct in your first callback.
You do need to make sure that clicking on the second button first does not cause any errors.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by