Skip to content

Instantly share code, notes, and snippets.

@vvps
Created September 6, 2013 10:15
Show Gist options
  • Save vvps/6462025 to your computer and use it in GitHub Desktop.
Save vvps/6462025 to your computer and use it in GitHub Desktop.
This is a small Matlab script to plot current/intensity values from a data in [x,y,current] or [x,y,intensity] format.
clear all
clc
%Read from file
load 'datafile';
x = datafile(:,1);
y = datafile(:,2);
I = datafile(:,3);
%Get min, max values and set resolution
minX = min(x);
maxX = max(x);
minY = min(y);
maxY = max(y);
normI = (I-min(I(:))) ./ (max(I(:)-min(I(:)))); %Normalise
xRes = 0.01;
yRes = 0.01;
%Set X,Y grid with x,y, values and impose a property grid on it.
[X,Y] = meshgrid(minX : xRes : maxX, minY: yRes : maxY);
PropertyGrid = griddata(x, y, normI, X, Y, 'nearest');
pcolor (X, Y, PropertyGrid); shading interp;
caxis([min(normI) max(normI)]);
colorbar('location','EastOutside');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment