Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Process Cells from Excel File

1 visualización (últimos 30 días)
Shashank
Shashank el 26 de Sept. de 2012
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Suppose I have a spreadsheet like this:
A B C
1: 0 45 87
2: 0 7 8
3: 1 65 68
4: 0 6 9
5: 1 0 9
I want to pick the value of cell in column C for the row in column A that has a value equal to 1. For example, read A3 and report/plot C3.

Respuestas (2)

Image Analyst
Image Analyst el 26 de Sept. de 2012
Did you look at what xlsread() returns? I bet you can find what you want there. (untested code)
numbers = xlsread(yourFileName);
columnA = number(:,1);
for row = 1 : length(columnA)
if columnA
fprintf('The value of column C in row %d = %f', row, number(row, 3));
end
end

Tom
Tom el 26 de Sept. de 2012
Editada: Tom el 26 de Sept. de 2012
I think this is what you're after, but I'm not totally sure.
A=[0 45 87
0 7 8
1 65 68
0 6 9
1 0 9];
B=any(A==1,2);
disp(A(B,3))

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by