Borrar filtros
Borrar filtros

Write in a text file from GUI appending new results down from older

2 visualizaciones (últimos 30 días)
Thanos Lampridis
Thanos Lampridis el 25 de Sept. de 2016
Respondida: Image Analyst el 25 de Sept. de 2016
I'm writing a GUI where i count seven values and put on a uitable. I want to push a button and, when i have new results, I want to append them down from the older several times. The idea is that when i push the button Save Results to Text File these values go to a text file named "My Results.txt" and when I have new values to append them down from these. Something like this
hammer -0.148 -0.2706 e.t.c pliers -0.248 -0.8979 e.t.c
My values go to the table with a separate button. The code is:
data = get(handles.uitable2, 'data');
data = {(get(handles.name,'String')),handles.imload1,handles.imload2,handles.imload3,handles.imload4,handles.imload5,handles.imload6,handles.imload7};
set(handles.uitable2, 'data', data);
Any help?

Respuestas (1)

Image Analyst
Image Analyst el 25 de Sept. de 2016
You get data from the uitable, but then you just overwrite it with your new data. You need to assign the new data to another variable and then append
data = get(handles.uitable2, 'data');
newData = {(get(handles.name,'String')),handles.imload1,handles.imload2,handles.imload3,handles.imload4,handles.imload5,handles.imload6,handles.imload7};
set(handles.uitable2, 'data', data);
data = [data; newData];
set(handles.uitable2, 'data'); % or handles.uitable2.Data = data;

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by