Home Need to make a 4D plot (3D + Colour)
 I need to make a 3D surface where colour will represent the fourth variable. I know "surf" is SIMILAR to what I need, but that did not work fine. Basically my data obtained from photododie sensor scanning along x,y,z and the forth variable is the intensity( data). The data are stored in text files in the following order. Total files=2380 in each file there are 4 columns and 480 rows. the columns represent x,y,z,data I was trying to plot the 3D surface but got this error " Error using matlab.graphics.chart.primitive.Surface/set Value must be a vector or 2D array of numeric type". Please help Here is the code close all; close all; Axstep=2.5; % scanning with 2.5 micron step along x and y directions Axlines=2380; %number of text files( in each file there are 4 column of equal sized data (x,y,z,data) and 480 rows) Path = 'C:\Users\asay0001\Google Drive\matlab\exp2_27-11-17_CONF09\all data - Copy'; Data = zeros(480,Axlines); % 480 rows in one file out of 2380 for i = 1:Axlines DataTemp = importdata([Path '\DATA (' num2str(i) ').txt']); Data(:,i) = DataTemp(:,4); % read column 4 which represents data to be ploted end [x y,z] = meshgrid([-3200:2.5:-2602.5],[325:2.5:672.5],[-800:100:800]); surf(x,y,z,Data')