how to transmit the cell's value of 2 Columns to another 2 Columns in a uitable by clicking a Push Button (GUI && Matlab)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everybody,
i want to transmit the Value off the ( Energie(t) && Predictive Energie(t) ) Columns to ( Energie(t-1) && Predictive Energie(t-1) ) after pushing a button (See atached Image)
by the first time clicking on my Button the Values off (Hauptantrieb, Klima,Heizung...) will be filled in the first two columns (( Energie(t) && Predictive Energie(t) )) but after hitting the Button again i want to transmit this Value to ( Energie(t-1) && Predictive Energie(t-1) ) Columns and at the same points i wanna get the current value of my Variables (Hauptantrieb, Klima,Heizung...) and put them in ( Energie(t) && Predictive Energie(t) ) Columns.
is like the result of my current Simulation, will be set by the next Simulation as past results.
does anybody how i can realise that ?
0 Commenti
Risposta accettata
Geoff Hayes
il 4 Set 2016
Alex - if you can assume that when you launch your GUI that all elements in the table are empty, then you can make the decision whether you need to move the first and second columns to the fourth and fifth respectively. Try
function pushbutton1_Callback(hObject, eventdata, handles)
% get the table data
tableData = get(handles.uitable1,'Data');
% if all elements in the first column are not empty then...
if all(~isempty(cell2mat(tableData(:,1))))
% move columns one and two to columns four and five
tableData(:,4) = tableData(:,1);
tableData(:,5) = tableData(:,2);
end
% update columns one and two with your data
tableData(:,1) = mat2cell(randi(255,6,1),ones(6,1));
tableData(:,2) = mat2cell(randi(255,6,1),ones(6,1));
set(handles.uitable1,'Data',tableData);
The use of randi is just an example. You would copy your data from elsewhere in order to populate these first two columns.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!