Borrar filtros
Borrar filtros

How can I read from file with loop ?

3 visualizaciones (últimos 30 días)
Dzhamshed
Dzhamshed el 7 de Ag. de 2012
Hello to all, I am trying to read data from excel file and each 10 second update and plot it. Here is the main part of my m-code, if smb need I can paste the whole code.
function [x,y] = readExcelColumns (fileName, xColNum, yColNum)
a= xlsread(fileName);
x=a(:,xColNum);
y=a(:,yColNum)
function updateAxes (hObject, eventdata, handles)
xColNum = get(handles.popupmenuX, 'value');
yColNum = get(handles.popupmenuY, 'value');
fileName=handles.fileName;
inf = 1;
* for k=1:1000
[x,y] = readExcelColumns (fileName, xColNum, yColNum)
plot (handles.axes1,x,y)
pause (10);
if k==0
break;
end
end*
function pushbuttonSTOP_Callback(hObject, eventdata, handles)
inf = 0;
  3 comentarios
Sriram
Sriram el 7 de Ag. de 2012
where you got stuck?
Dzhamshed
Dzhamshed el 7 de Ag. de 2012
OK, I have a file which updates each 20 sec, and I want to have a plot of some columns, I made a loop for reading file infinitly, but it plots just one time and no more... here is the whole code http://pastebin.com/encDs5XJ

Iniciar sesión para comentar.

Respuestas (3)

Sriram
Sriram el 7 de Ag. de 2012
plot axes is getting updated.. there is no issue on that ... make sure you have x an y variables updates....
for i = 1:1:10
x = rand(i);
y =rand(i);
plot(handles.axes1,x,y)
title(i)
pause(1)
end
the above sample code (as you did for plot) works fine... so try to make sure whether x and y variables get updated , and also make the delay (pause(10)in your code ) to be minimal when you debug whch ll be helpful...!
  1 comentario
Dzhamshed
Dzhamshed el 7 de Ag. de 2012
I think x,y updates as I included the function, called [x,y] = readExcelColumns (fileName, xColNum, yColNum) in the loop, but whatever it doesn't update(((

Iniciar sesión para comentar.


Dzhamshed
Dzhamshed el 7 de Ag. de 2012
Sriram, I think x,y updates as I included the function, called [x,y] = readExcelColumns (fileName, xColNum, yColNum) in the loop, but whatever it doesn't update(((
  4 comentarios
Sriram
Sriram el 7 de Ag. de 2012
Editada: Sriram el 7 de Ag. de 2012
Fine... hope now you could solve it.... (xlsread will work fine)
Dzhamshed
Dzhamshed el 7 de Ag. de 2012
I didn't solve it, it doesn't work, as it was. Could you, please see my source code in order to help me?

Iniciar sesión para comentar.


Dzhamshed
Dzhamshed el 8 de Ag. de 2012
Pls, can anyone help me with this??? (((
  1 comentario
Sriram
Sriram el 9 de Ag. de 2012
can you attach the .fig (GUI) file

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import from MATLAB 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