How to get a value from a matrix?
Mostra commenti meno recenti
Hi guys, I have a question that on the first glance seems really simple. I have a matrix of 2 columns and I have a value of the first column and want to know the corresponding value from the second column, For instance I have the following matrix:
Data =
0.1 0.50
0.15 0.72
0.2 0.37
0.25 0.18
0.3 0.65
I have the first value, 0.25 and now i want to know how to get the 0.18 from the matrix. The matrix of my problem has much more rows, but it's the same principle. I already written a code that works when I have 100 rows, but when I have 200 rows it doesn't work anymore (data of the second and first column also depend on the number of rows). This is the code I already wrote:
Uva = [x; T_plot]' %This is my matrix
ind1 = Uva(:,1) == 0.591; %Look for the right x
A1 = Uva(ind1,:); %Pick the row
Tsim = A1(2); %Assign the outcome to a new name
Can someone please help me?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!