How to write image from random matrix data ?

6 views (last 30 days)
Dhelp
Dhelp on 12 May 2015
Answered: Walter Roberson on 12 May 2015
Hi,
I have data in a matrix which is random, means not arranged in incremental order of (x,y) part for z value. In short a matrix of z data based on (x,y) coordinates. I used griddata and imwrite command but since I have different z data for similar or near(x,y) coordinates , the .png image was not as required. Is there another way to do this ?

Answers (1)

Walter Roberson
Walter Roberson on 12 May 2015
There are alternatives to griddata() such as scatteredInterpolant evaluated upon a grid. Some of them allow you to adjust the interpolation method. But all of them are going to use multiple values to deduce the value at any one location. If you need to be more precise then you could increase the resolution, producing a larger matrix.
Perhaps what you would like is to use scatter() with a small pointsize and with the c (color) value set according to the z coorinate. There are various ways to capture the result into a matrix, including getframe() and print() and saveas()

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!