Update plot uitable problem

4 visualizzazioni (ultimi 30 giorni)
Hivanu Ince
Hivanu Ince il 9 Dic 2019
Modificato: Walter Roberson il 11 Dic 2019
hey, I'm a Matlab beginner and I need help...
I've got a 2x2 table to define an area. I've created a ui within my function just to show the table and plot the area. this is how far I am right now. what's left is that I'd like the plot to update when the values in the table change. the values are editable but the plot remains the same.
any help is appreciated!!
t = table(Drehzahl, Drehmoment, 'RowNames',{'Startpunkt' 'P1' 'P2' 'P3' 'Endpunkt'});
fig = uifigure;
fig.Position(3:4) = [822 360];
uit = uitable(fig,'ColumnEditable',true);
uit.Data = t;
uit.FontSize = 10;
uit.FontWeight = 'bold';
uit.ColumnEditable = true;
uit.Position(3) = 375;
ax = uiaxes(fig);
ax.Position(1) = 415;
ax.YLabel.String = 'Drehmoment [Nm]';
ax.XLabel.String = 'Drehzahl [rpm]';
x = t{:,1};
y = t{:,2};
area(ax,x,y);
ax.XLim = [0 45];
ax.YLim = [0 2000];
ax.Title.String = 'Feld der gefahrenen Punkte';
  1 Commento
Ankit
Ankit il 10 Dic 2019
You can use DisplayDataChangedFcn callback but it is available in r2019. I have not seen it in 2018b or previous release.

Accedi per commentare.

Risposta accettata

Ankit
Ankit il 10 Dic 2019
After a while, I found a solution to this problem:
t = table(Drehzahl, Drehmoment, 'RowNames',{'Startpunkt' 'P1' 'P2' 'P3' 'Endpunkt'});
fig = uifigure;
fig.Position(3:4) = [822 360];
uit = uitable(fig,'ColumnEditable',true);
uit.Data = t;
uit.FontSize = 10;
uit.FontWeight = 'bold';
uit.ColumnEditable = true;
uit.Position(3) = 375;
uit.CellEditCallback = @updateFigure;
ax = uiaxes(fig);
ax.Position(1) = 415;
ax.YLabel.String = 'Drehmoment [Nm]';
ax.XLabel.String = 'Drehzahl [rpm]';
x = t{:,1};
y = t{:,2};
area(ax,x,y);
ax.XLim = [0 45];
ax.YLim = [0 2000];
ax.Title.String = 'Feld der gefahrenen Punkte';
function updateFigure(src,event)
x = uit.Data(:,1);
y = uit.Data(:,2);
area(ax,x,y)
end
  1 Commento
Hivanu Ince
Hivanu Ince il 11 Dic 2019
that worked perfectly, thank you so much!
do you know, how the new edited values can be stored in a vector??

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Develop uifigure-Based Apps in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by