<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Philipp</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">>problem solved.....I had to think
differently than before.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Heh!</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">It helps to know what you actually want
to do (and also the size of the problem).<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Cheers,<br>
</div>
<div class="moz-cite-prefix">Claus<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 18.02.2019 18:08, P M wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CACf7ODvmXSs_N3Akqv4yNFzi_Y+xp4Xmg7di3ckde6bjUw3dng@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>
<div>problem solved.....I had to think differently
than before.<br>
<br>
</div>
Actually my goal was to compare point coordinates
to map coordinates and find the points on the map
which are closest to the given point coordinates.<br>
<br>
</div>
<div>The map is of width: 900 // in reality
the map is based on an image with 900x1500 pixels<br>
</div>
<div>The map is of height: 1500<br>
</div>
<div><br>
</div>
<div>The points are building a line on the
map...e.g: the line consists of 1076 points<br>
</div>
<div>So from the map I have build:<br>
<br>
</div>
<div>x = map(1,:); // contains all x coordinates
of the map<br>
y = map(2,:); // contains all y coordinates of
the map</div>
<div><br>
</div>
<div>points = [ lineX, lineY]; // points
contain the X-Y-coordinates of the line<br>
<br>
for i = 1:n<br>
actPoint = points(i,:);<br>
[nearestX xInd] = min(abs(actPoint(1)-x));<br>
[nearestY yInd] = min(abs(actPoint(2)-y));<br>
nearestPoint(i,:) = [x(xInd) y(yInd)];<br>
end</div>
<div><br>
<br>
</div>
<div>This is what works for now, though it is still
slow.<br>
</div>
<div><br>
For searching 100 points of the line it needs
about 10 seconds.<br>
For searching 200 points of the line it needs
about 19 seconds.</div>
<div>For searching 500 points of the line it needs
about 45 seconds.<br>
For searching 1000 points of the line it needs
about 98 seconds.</div>
<div><br>
<br>
<br>
<br>
</div>
<br>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Am Mo., 18. Feb. 2019 um
16:39 Uhr schrieb P M <<a
href="mailto:p.muehlmann@gmail.com" moz-do-not-send="true">p.muehlmann@gmail.com</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">
<div>Ok, thanks for your help..<br>
<br>
</div>
<div>Actually the sizes I gave where just for
demonstation.<br>
<br>
</div>
<div>If I use the real array sizes, I get a message: can
not allocate 7469.60MB memory...which maybe is true.<br>
</div>
<div>available RAM after starting Scilab is 3701 MB<br>
<br>
</div>
<div>actual array sizes:<br>
<br>
A has 1076 elements<br>
</div>
<div>B has 1'350'000 elements, with a lot of Nan's in it<br>
<br>
</div>
<div>if I use thrownan(B) I can reduce the array size of B
to 867751 elements but still get the Message above.<br>
<br>
</div>
<div>(without thrownan() the memory scilab wants to
allocate is even bigger)<br>
</div>
<div><br>
<br>
<br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Am Fr., 15. Feb. 2019 um
23:25 Uhr schrieb Samuel Gougeon <<a
href="mailto:sgougeon@free.fr" target="_blank"
moz-do-not-send="true">sgougeon@free.fr</a>>:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<div
class="gmail-m_5577763922447151768gmail-m_3771141033949040913moz-cite-prefix">...
and even clearer, with respect to your own notations:<br>
<br>
<font size="-1"><tt>--> A = </tt></font><font
size="-1"><tt><font size="-1"><tt>rand(1,1000);</tt></font></tt></font><font
size="-1"><tt> // test's data</tt></font><font
size="-1"><tt><font size="-1"><tt> <br>
--> B = rand(1,10000);</tt></font><br>
--> [a, b] = ndgrid(A, B);</tt><tt><br>
</tt><tt>--> size(a)</tt><tt> // same for b<br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> 1000. 10000.</tt><tt><br>
</tt><tt>--> [v, i] = min(abs(a-b), </tt></font><tt><b>"c"</b></tt><font
size="-1"><tt>);</tt></font><br>
</div>
<br>
</div>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org" target="_blank"
moz-do-not-send="true">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a><br>
</blockquote>
</div>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<p><br>
</p>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>