Info

This question is closed. Reopen it to edit or answer.

to find z values for same x values

2 views (last 30 days)
Sila Dinc
Sila Dinc on 15 Sep 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hello, I have a data like this (it's actually a bigger data, an example is shown here):
x: 0
y: 2
z: 0.3
x: 0
y: 1
z: 0.4
x: 1
y: 1
z: 0.7
I want to find z values for same x values. I mean what are the values for z when x=0 or when x=1. Thank you in advance.
  3 Comments
Sila Dinc
Sila Dinc on 15 Sep 2020
Yes I want to select some values from existing data. I saved the data using fopen and fprintf functions to txt file. I did not do anything to save them as vectors, sorry I'm beginner and trying to find out. Thank you!
Rik
Rik on 15 Sep 2020
First you need to read everything back to Matlab variables so you have a result like this:
x=[0 0 1];
y=[2 1 1];
z=[0.3 0.4 0.7];
Then you can use normal comparison tools like == and find.

Answers (1)

KSSV
KSSV on 15 Sep 2020
Edited: KSSV on 15 Sep 2020
Read about griddata and scatteredIntepolant.

Tags

Community Treasure Hunt

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

Start Hunting!