How to make matlab wait for a value to be input in an empty excel cell
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Kota Matsuo
il 14 Nov 2016
Modificato: Kota Matsuo
il 15 Nov 2016
Hi,
I am trying to do some calculations using a table on my excel file as an input to my MATLAB code. Is it possible to tell MATLAB to wait until an empty excel cell receives a value (from other programs)?
For example, consider a MATLAB code that calculates the Z column using values from the Y column. The problem is that the Y column is calculated using another (very slow) program.
X | Y | Z |
-----------
1 | 23| 91|
2 | 42| 24|
3 | 26| 34|
4 | □|___|
5 | _ | __ |
□ is the empty cell waiting for an input from the other program. Once this value is received, MATLAB calculates the Z-value, and the other program calculates the next Y-value in the next row using the Z-value just calculated from MATLAB.
My explanation might be confusing, but I hope you understand my question.
Thank you very much in advance!
0 Commenti
Risposta accettata
Image Analyst
il 14 Nov 2016
Can't you just put xlsread() in a loop and check the value. Then break from the loop once the cell is not empty. I'd also put a check on time since you don't want to get into an infinite loop you can't get out of, like wiat for 100 seconds or so
startTime = tic;
elapsedTime = toc(startTime);
while elaspedTime < 100
[numbers, strings, raw] = xlsread(......
if ~isempty(some cell........
break; % Exit from the loop since they entered something.
end
elapsedTime = toc(startTime);
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spreadsheets 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!