to find z values for same x values

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

Do you mean you want to select those values from your existing data? If so, how is your data stored? Fields of a struct array? Vectors? An array?
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!
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.

This question is closed.

Tags

Asked:

on 15 Sep 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!