
clear all 

close all
clc
%% Import data from text file.
% Script for importing data from the following text file:
%
%    Messdatei.csv
%
% To extend the code to different selected data or a different text file,
% generate a function instead of a script.

% Auto-generated by MATLAB on 2017/11/14 16:24:12

%% Initialize variables.
filename = 'Messdatei.csv';
delimiter = ',';
startRow = 8;

%% Format for each line of text:
%   column1: double (%f)
%	column2: double (%f)
%   column3: double (%f)
% For more information, see the TEXTSCAN documentation.
formatSpec = '%f%f%f%*s%*s%[^\n\r]';

%% Open the text file.
fileID = fopen(filename,'r');

%% Read columns of data according to the format.
% This call is based on the structure of the file used to generate this
% code. If an error occurs for a different file, try regenerating the code
% from the Import Tool.
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines' ,startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');

%% Close the text file.
fclose(fileID);

%% Post processing for unimportable data.
% No unimportable data rules were applied during the import, so no post
% processing code is included. To generate code which works for
% unimportable data, select unimportable cells in a file and regenerate the
% script.

%% Create output variable
Messdatei = [dataArray{1:end-1}];
%% Clear temporary variables
clearvars filename delimiter startRow formatSpec fileID dataArray ans;



data = Messdatei;
x = data(:,1);
y = data(:,2);
z = data(:,3);

X = reshape(x,506,1561);
Y = reshape(y,506,1561);
Z = reshape(z,506,1561);


figure(1)
surf(X,Y,Z)
shading interp
colormap jet
view(2)
xlim([124 146]);
%ylim([24 530]);