How to print value in 3 column table

5 views (last 30 days)
Brian Espino
Brian Espino on 10 Jul 2019
Commented: KSSV on 10 Jul 2019
I have a table with 3 columns and a lot of rows. Column 1 has x variable which is a whole real number, Column 2 has y var " " . I ask for input x and y, how can i print the third column? This is after having table on workspace lets call table 'table'
x= input('what is x val")
y=input('what is y val')
x = [table]
from here how do i find the specific value of x, y then print out the last value from the respective row?
Thanks in advance.
  1 Comment
Brian Espino
Brian Espino on 10 Jul 2019
Ai= input('What is your A number? ');
Bi= input('What is your B number? ');
A= table(:,1);
B=table(:,2);
C=table(:,end);
F = scatteredInterpolant(A,B,C);
Ci=f(Zi,Ai);
fprintf(Ci)

Sign in to comment.

Answers (1)

KSSV
KSSV on 10 Jul 2019
Read about scatteredInterpolant
n = 10 ;
x = rand(n,1) ; y = rand(n,1) ; z = rand(n,1) ;
F = scatteredInterpolant(x,y,z) ;
xi = rand ; yi = rand ;
zi = F(xi,yi)
  2 Comments
Brian Espino
Brian Espino on 10 Jul 2019
Error using scatteredInterpolant
The input points must be a double array.
Error i get. can upload full code to give u idea
KSSV
KSSV on 10 Jul 2019
Your x,y,z might be single, convert them to double using double.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!