Group Abstract Group Abstract

Message Boards Message Boards

Plot 3D experimental data?

Posted 10 years ago
Attachments:
POSTED BY: Gabriel Meloni
6 Replies
POSTED BY: Marco Thiel
POSTED BY: Gabriel Meloni

Hi Gabriel,

Gianluca is right:

dat = Import["~/Downloads/Data_exp.dat"];
datclean = Flatten[ToExpression[StringSplit[#, ","]]] & /@ dat[[19 ;; -2]];
X = datclean[[1]]; (*Should be row 1*)
Y = 
 datclean[[3]]; (*Should be row 2 and so on...*)
Z = datclean[[5]];
Xrel = datclean[[2]];
Yrel = datclean[[4]];
Zrel = datclean[[6]];
Chanel1 = datclean[[7]];
XYplane = Riffle[X, Y];
surface = Partition[Riffle[XYplane, Chanel1, 3], 3]; 
surface // MatrixForm

gives

enter image description here

Alternatively to my cleaning function you could of course import the data differently:

dat = Import["~/Downloads/Data_exp.dat", "CSV"];

Cheers,

M.

POSTED BY: Marco Thiel

Hi Murray, Thank you for the reply! As I cannot attach this file (might be my own incompetence) I am sending a dropbox link for the file!

https://www.dropbox.com/s/vn4k3zaj9r4q7xm/Data_exp.dat?dl=0

Cheers

POSTED BY: Gabriel Meloni

It seems that the numerical part of your array is made of strings instead of numbers. You can convert the strings this way:

{{"600.000,0.000,100.000,0.000,109.000,0.000,3.784,"}, \
{"590.000,-10.000,100.000,0.000,109.000,0.000,3.174,"}, \
{"580.000,-20.000,100.000,0.000,109.000,0.000,2.747,"}, \
{"570.000,-30.000,100.000,0.000,109.000,0.000,2.411,"}} /. \
{str_String} :> ToExpression[StringSplit[StringDrop[str, -1], ","]]
POSTED BY: Gianluca Gorni
POSTED BY: Murray Eisenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard