0

Update my modified code -> the wrong point is marked! see the colorbar! :)

Input_Matrix = textread('Rainflow_Input1.txt')
[zeilen,spalten]=size(Input_Matrix)
x = Input_Matrix(:,1)
y = Input_Matrix(:,2)
z = Input_Matrix(:,3)
colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]);

az = 0;
el = 90;
view(az, el);


%scatter3(x,y,z,'filled')%Problem i dont know to make it filled
view(0,90)% view from above !!!http://de.mathworks.com/help/matlab/ref/view.html
a = 30;%markersize
scatter3(x, y, z, a, z, 'filled');
view(0, 90)
idx = find(max(z)) ;
hold on
plot3(x(idx),y(idx),z(idx),'*r')
colorbar
datacursormode on

How can I figure out the highest value in my diagram? I want to mark it in my diagram. So the x y and z value should be displayed from the highest value -> z!. Thank you for your help guys. I really appreciate it.

Input_Matrix = textread('Rainflow_Input1.txt')
[zeilen,spalten]=size(Input_Matrix)
x = Input_Matrix(:,1)
y = Input_Matrix(:,2)
z = Input_Matrix(:,3)
colorbar('location','Manual', 'position', [0.93 0.1 0.02 0.81]);

az = 0;
el = 90;
view(az, el);


%scatter3(x,y,z,'filled')%Problem i dont know to make it filled
view(0,90)% view from above !!!http://de.mathworks.com/help/matlab/ref/view.html
a = 30;%markersize
scatter3(x, y, z, a, z, 'filled');
view(0, 90)
colorbar;
datacursormode on
;

My input:

-220.8  228 50045
-222    201.6   50045
-220.2  198 200176
-224.4  196.8   200176
-220.8  192 200176
-221.4  190.8   50044
-226.2  176.4   200176
-199.2  156 50044
-201.6  153.6   50045
-219    147.6   50044
-252.6  133.2   50044
-210    129.6   200176
-250.8  127.2   50044
-201    126 50044
-229.2  124.8   50044
-183    123.6   200176
-168    122.4   200176
-275.4  118.8   200176
-261    13.2    400352
-259.8  13.2    200176
-258.6  13.2    200176
-257.4  13.2    290176
Lutz
  • 19
  • 4

1 Answers1

1

The maximum value (of z I assume) of your data will be m in index ind

[m,ind]=max(z);

If you are worried that there are more than one, you can then always do

indexes=find(z==m);

To mark them, after the call to scatter3 do a hold on and call scatter3 just with the maximum valued data, and another format e.g. '*' and maybe some other color

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
  • ok... but I want to display this data in the same window and this point should be marked – Lutz Sep 27 '16 at 09:42
  • sorry @Ander Biguri can you post the code? I am new in matlab so my skills are not good ;) – Lutz Sep 27 '16 at 09:50
  • That is the code... @LaraHäusl . If it is scatter3 what you are worried about, you shoudl be able to write it, as you already wrote 1 scatter3 – Ander Biguri Sep 27 '16 at 09:51
  • I have posted my new code. you can see the wrong point is marked! the point with the highest value from the colorbar should be marked. – Lutz Sep 27 '16 at 10:50
  • @LaraHäusl I wrote 2 lines of code and you mixed them up and use neither of them... Use the first one only. – Ander Biguri Sep 27 '16 at 10:58
  • @LaraHäusl please consider accepting the answer as valid then – Ander Biguri Sep 27 '16 at 11:14