http://de.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2016-10-23T06:00:07Ztag:de.mathworks.com,2005:Question/3086882016-10-23T05:56:54Z2016-10-23T06:00:07ZUnable to compile using "mex fmpc_sim.c libmwblas.lib libmwlapack.lib" undefined reference to '_dgemm_' <p>I am having the exact same problem as <a href = "https://www.mathworks.com/matlabcentral/answers/172057-error-using-mex-line-206-unable-to-complete-successfully">https://www.mathworks.com/matlabcentral/answers/172057-error-using-mex-line-206-unable-to-complete-successfully</a></p><p>I installed matlab2011a (32 bit) in windows10 (64bit).</p><p>I tried to install Fast Model Predictive Control Using Online Optimization from <a href = "http://stanford.edu/~boyd/fast_mpc/">http://stanford.edu/~boyd/fast_mpc/</a> which contain a Mex solver. During the setup step, I am supposed to compile a c file fmpc.c using</p><pre class="language-matlab">mex fmpc_sim.c libmwblas.lib libmwlapack.lib
</pre><p>But for whatever reason, it says there are a bunch of undefined references. I have followed the instructed nearly exactly as stated, what could be going wrong? How do I solve this reference error?</p><pre class="language-matlab">EDU>> mex -setup
</pre><pre class="language-matlab">Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2011a/win32.html
</pre><pre class="language-matlab">Please choose your compiler for building MEX-files:
</pre><pre class="language-matlab">Would you like mex to locate installed compilers [y]/n? y
</pre><pre class="language-matlab">Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~2\MATLAB\R2011A~1\sys\lcc
</pre><pre class="language-matlab">[0] None
</pre><pre class="language-matlab">Compiler: 1
</pre><pre class="language-matlab">Please verify your choices:
</pre><pre class="language-matlab">Compiler: Lcc-win32 C 2.4.1
Location: C:\PROGRA~2\MATLAB\R2011A~1\sys\lcc
</pre><pre class="language-matlab">Are these correct [y]/n? y
</pre><pre class="language-matlab">Trying to update options file: C:\Users\n\AppData\Roaming\MathWorks\MATLAB\R2011a\mexopts.bat
From template: C:\PROGRA~2\MATLAB\R2011A~1\bin\win32\mexopts\lccopts.bat
</pre><pre class="language-matlab">Done . . .
</pre><pre class="language-matlab">**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
Building with the -largeArrayDims option enables the new API.
**************************************************************************
</pre><pre class="language-matlab">EDU>> mex fmpc_sim.c libmwblas.lib libmwlapack.lib
Writing library for fmpc_sim.mexw32
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dgemm_'
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dposv_'
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dgemv_'
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_daxpy_'
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dtrtrs_'
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dtrsv_'
c:\users\n\appdata\local\temp\mex_89dw4r\fmpc_sim.obj .text: undefined reference to '_dnrm2_'
</pre><pre> C:\PROGRA~2\MATLAB\R2011A~1\BIN\MEX.PL: Error: Link of 'fmpc_sim.mexw32' failed. </pre><pre class="language-matlab">??? Error using ==> mex at 208
Unable to complete successfully.
</pre><p><b>Installation instructions for fast_mpc</b>
-----------------------------------------------------------------------</p><p>fast_mpc is written in C with a mex interface to MATLAB. Before
installation, make sure that BLAS and LAPACK libraries are installed
in your machine.</p><p>1. Unpack the fast_mpc files, or get them individually.</p><p>2. Start MATLAB and cd to the directory containing the source files.</p><p>3. At the MATLAB command prompt type</p><pre> >> mex -setup</pre><pre> and enter the number corresponding to the template option gccopts.sh.</pre><p>4. Compile fmpc_sim.c using</p><pre> >> mex fmpc_sim.c</pre><pre> On some machines you may need to specify the libraries</pre><pre> >> mex fmpc_sim.c -lblas -llapack</pre><pre> If you want to link your own libraries, you can. For example,
to link the libraries libacml.a, libacml_mv.a, and libgfortran.a
in the directory /opt/acml/lib, use the option '-L' to specify the
library search path and the option '-l' to specify the individual
libraries, as in</pre><pre> >> mex fmpc_sim.c -L/opt/acml/lib -lacml -lacml_mv -lgfortran</pre><p>5. If fmpc_sim.c compiles successfully, do the same with fmpc_step.c.</p><p>6. Test the installation by running the masses_example script</p><pre> >> masses_example</pre><pre> which will run MPC, for 100 iterations, on the masses example in the paper,
using mpc_step. You should see reports from each iteration printed to your
screen. The last one, for example, should look like</pre><pre> iteration step rd rp
0 0.3874 1.09294e+01 1.27108e+00
1 1.0000 1.54052e+00 1.39748e-14
2 1.0000 2.98332e-01 1.40216e-15
3 1.0000 1.16741e-02 1.02482e-15</pre><p>The average cost is: 5.683200</p><pre> Test mpc_sim by running the script randsys_example.</pre>Bolinhttp://de.mathworks.com/matlabcentral/profile/authors/2961758-bolintag:de.mathworks.com,2005:Question/3086872016-10-23T05:53:05Z2016-10-23T05:53:05Zwhat is the command used to run the matlab code line by line?<p>I have been getting different peak values while using the for loop. But the obtained peak locations are wrong, so i need to check what is happening in my code. How can i check my code line by line?</p>rithicka yogeeswaranhttp://de.mathworks.com/matlabcentral/profile/authors/7682835-rithicka-yogeeswarantag:de.mathworks.com,2005:Question/3086862016-10-23T05:35:43Z2016-10-23T05:35:43ZI am making a gui with 5 radiobuttons in a buttongroup. I am trying to make the 'answer' appear in the workspace. However, i cant even get my two radiobuttons to function. Help me. <p>function uibuttongroup1_SelectionChangedFcn(hObject, eventdata, handles)
handles=guidata(hObject);
switch get(eventdata.NewValue, 'Tag')
case 'radiobutton1'
handles.value = 1;
answer = get(hObject, 'Value');
case 'radiobutton2'
handles.value = 2;
answer = get(hObject, 'Value');
end</p>Norkhaleeda Hassanhttp://de.mathworks.com/matlabcentral/profile/authors/8870566-norkhaleeda-hassantag:de.mathworks.com,2005:Question/3085832016-10-22T11:36:50Z2016-10-23T05:30:10ZFinding signature for classification<p>I have done up through point (3a) but I am not getting points (3b) and (3c).</p><p>Can anyone help me with implementing point (3b) and (3c)? See image below for the algorithm:</p><img src = "http://www.mathworks.com/matlabcentral/answers/uploaded_files/61769/img.jpg"><p>Point (3b) : Find the edge points within approximately 2 pixels of the y-axis. <b>(I don't understand this.)</b></p><pre> [li n]=bwlabel(res);
stats=regionprops(li,'Centroid');
center=stats(1).Centroid;
cx=center(1);
cy=center(2);</pre><pre> br=bwboundaries(li);
boundary=br{1};
bx=boundary(:,1);
by=boundary(:,2);</pre><pre> subx=bx-cx;
suby=by-cy;</pre><pre> subcor=[subx suby];</pre><pre> for x=0:359
rx=(cos(x*pi/180).*subx - sin(x*pi/180).*suby);
ry=(sin(x*pi/180).*subx + cos(x*pi/180).*suby);
end</pre>Rashid Hussainhttp://de.mathworks.com/matlabcentral/profile/authors/8495585-rashid-hussaintag:de.mathworks.com,2005:Question/3086852016-10-23T05:27:11Z2016-10-23T05:27:11ZError using * MTIMES is not fully supported for integer classes. At least one input must be scalar<p>I m traying to create an NMF algorithm (the multiplicative update rules) to decompose an image ento 2 matrix, but a message error apperas "Error using * MTIMES is not fully supported for integer classes. At least one input must be scalar" at line 5 . could u plz help me</p><p>V=imread('circuit.tif');
[m,n]= size(V);
for iter=1:Niter;
for W0 = rand (m,r);
H0 = h0.* (V*w0')./((w0'*w0)*h0 + (10^-9));
gradW = W*(H*H') - V*H';
gradH = (W'*W)*H - W'*V;
end
for h0=rand(r,n);
w0= w.*(V*h0')./(w0*h0*h0'+10^-9);
gradW = W*(H*H') - V*H';
gradH = (W'*W)*H - W'*V;
end
projnorm = ([norm(gradW(gradW<0 | W>0)); norm(gradH(gradH<0 | H>0))]);
if projnorm < tol*initgrad | iter == Niter | cputime-initt > timelimit,
fprintf('Iter = %d Final proj-grad norm %f\n', iter, projnorm);
break
end
W = W.*(V*H')./(W*(H*H'));
H = H.*(W'*V)./((W'*W)*H);
end</p>marwa jendoubihttp://de.mathworks.com/matlabcentral/profile/authors/9042750-marwa-jendoubitag:de.mathworks.com,2005:Question/3086842016-10-23T05:14:57Z2016-10-23T05:14:57ZChanging dendrogram x-axis<p>Hi.. I have generated a dendrogram plot of the hierarchical binary cluster tree. I need to change the x axis of dendrogram plot by calling it from work space (say like B, A is data). Now I see the x-axis in form of ordered numbers starting from 1. A is 64x3 and B is 64x1, B is integer representing some real sample number. So I need the plot to be in a way, I can classify my samples.
Expecting your help.</p>Jassim Abubackerhttp://de.mathworks.com/matlabcentral/profile/authors/9042708-jassim-abubackertag:de.mathworks.com,2005:Question/3086832016-10-23T05:01:52Z2016-10-23T05:01:52ZWhy I am getting this error "No connector at hos"?<p>I'm trying to read the sensor data from mobile but when i am entering the ip address of my computer it shows "No connector at host". My system connected with LAN and my phone is connected with wi-fi. I don't know how to rectify the problem. Kindly anyone help me with this. Thanks in advance.</p>Mallika Lhttp://de.mathworks.com/matlabcentral/profile/authors/8967825-mallika-ltag:de.mathworks.com,2005:Question/3086792016-10-23T04:20:10Z2016-10-23T04:57:27ZPut some background pixel into top and bottom of a image<img src = "/matlabcentral/answers/uploaded_files/61812/q3.jpg"><p>I have a image like this and I want to put some background pixels to top and bottom of the image.
How to do this??</p>Malan Jayankahttp://de.mathworks.com/matlabcentral/profile/authors/8393959-malan-jayankatag:de.mathworks.com,2005:Question/3086822016-10-23T04:44:24Z2016-10-23T04:44:24ZHow can I get rid of the dark foreground text from this grayscale image? I need a matlab code if is it possible, please?<img src = "/matlabcentral/answers/uploaded_files/61814/img2.png">Ahmad Yahyahttp://de.mathworks.com/matlabcentral/profile/authors/8984285-ahmad-yahyatag:de.mathworks.com,2005:Question/571862012-12-21T19:36:43Z2016-10-23T04:41:58ZHow can I rescale an image while not changing the dimension of the image?<p>How can I rescale an image while not changing the dimension of the image? When I scale it up, it just crops the image to fit within the original size. When I scale it down, it pads the edges of the image with zeros. I want to zoom in and out about the center of the image. When using "imresize", it changes the dimensions of the image to preserve all the content. I have the image processing toolbox.</p>Sonoma Richhttp://de.mathworks.com/matlabcentral/profile/authors/436243-sonoma-richtag:de.mathworks.com,2005:Question/3086812016-10-23T04:41:40Z2016-10-23T04:41:40ZPlot nested loop data<p>Hello everyone. I have a simple question to ask since I am a bit confused. I have a following dummy code like this -</p><pre> iter = 1e2;
myvar= zeros(500,iter);
for k = 1:iter
for ii=1:500
%body of my code
myvar(ii, k) = myvar(ii) + det (I_mat + var(ii) * A_mat);
end
end</pre><p>At the end of code, the variable "myvar" will store all the iterations data in the matrix of size 500x100. So my question is, how can i find the mean of each column of "myvar" matrix and plot this data? Any advice is really appreciated.</p><p>Thank you,</p>androidguyhttp://de.mathworks.com/matlabcentral/profile/authors/5530816-androidguytag:de.mathworks.com,2005:Question/3086802016-10-23T04:28:08Z2016-10-23T04:28:08ZCombining plots with Python<p>Dear Community,</p><p>I would like to know if there's a possibility to merge MATLAB's plots with the ones created in Python by matplotlib? If so, how can I do that?</p><p>Thanks in advance,
Quittend</p>Mateusz Pieniakhttp://de.mathworks.com/matlabcentral/profile/authors/9042602-mateusz-pieniaktag:de.mathworks.com,2005:Question/3086782016-10-23T04:18:27Z2016-10-23T04:26:57ZHow can one convert a 3d matrix of ones and zeros this into a 3d image with the ones being solid voxels and the zeros being empty voxels. thanks :)<p>I am relatively new to matlab. I have created a three-dimensional matrix of ones an zeros and I would like to find a way of converting this into a 3d image with the ones being solid voxels and the zeros being empty voxels. Any help would be much appreciated thanks :)</p>Samuel Sackshttp://de.mathworks.com/matlabcentral/profile/authors/8437050-samuel-sackstag:de.mathworks.com,2005:Question/3086722016-10-23T02:11:14Z2016-10-23T04:19:18ZUndefined function or variable 'y'.<p>I'm trying to compute sin(x) with the nth order of the Taylor Series around a = 0;
The function is</p><pre class="language-matlab">function [y] = TaylorSeries(n,x)
</pre><pre class="language-matlab">for i = 0:n
y = y + ((-1)^i * x^(2*i + 1))/(factorial(2*i + 1));
end
end
</pre><p>I'm getting -> Undefined function or variable 'y'.</p><p>Error in TaylorSeries (line 4)
y = y + ((-1)^i * x^(2*i + 1))/(factorial(2*i + 1));</p><p>What's wrong? I can't seem to get on well with Matlab.</p>Leandro Cavalheirohttp://de.mathworks.com/matlabcentral/profile/authors/8116429-leandro-cavalheirotag:de.mathworks.com,2005:Question/3086112016-10-22T16:23:52Z2016-10-23T04:15:34ZMatlab strikes again with missing functionality for bode plots<p>Per usual I'm spending my weekends fighting with software that has the functionality of a ti89</p><p>I would like to have a sliding cursor on a bode plot so that i may locate a point at 180 degrees on the phase plot and have it go on the frequency plot also to define a gain margin. I have yet to be able to do this. So I'm assuming yet again matlab can't do this. I mean why would they? Every other single piece of simulation software on the planet allows you to at a minimum put a cursor on a set x or y point and find the value. We can't even do that math works? Your also going to tell me that for thousands and thousands of dollars the simulink data inspector has no functionality to make a bode plot? At least the data inspector has a sliding cursor.
This is pretty sad considering what matlab costs</p>Roberthttp://de.mathworks.com/matlabcentral/profile/authors/2986565-roberttag:de.mathworks.com,2005:Question/3086762016-10-23T03:29:26Z2016-10-23T04:01:57ZCreating binary matrix with at least q ones on each row<p>I have a matrix which is intended to represent gender, so I want it to be roughly 0's and 1's. I am doing it as follows:</p><pre class="language-matlab">sex=round(rand(m,n));
</pre><p>The problems is that sometimes generates rows with only 0's or 1's. I want to change it so that it always contains at least q 1's and at most k 0's. Is there an easy way to do this?</p>Josue Sandovalhttp://de.mathworks.com/matlabcentral/profile/authors/8925292-josue-sandovaltag:de.mathworks.com,2005:Question/3086732016-10-23T02:30:59Z2016-10-23T03:57:55Zhow to reject of the next value less than the previous one<p>Hi to all the Matlab users, I have made a program in which I want to accept the value in a loop which is less than the previous one. Kindly advise. e.g. if first value at the start of the loop is 10 then next value comes 10.3 next 9.6..... I want that 10.3 should be rejected and 9.6 gets accepted and so on......... Kindly suggest..... Regards.....</p>Offroad Jeephttp://de.mathworks.com/matlabcentral/profile/authors/4899830-offroad-jeeptag:de.mathworks.com,2005:Question/3086742016-10-23T02:53:45Z2016-10-23T03:49:01Zselection of particular rows from a matrix?<p>I would like to select rows from a matrix in a particular pattern as: row nos 1,2,3,5,6,7,9,10,11,13 and so on. Please help me in coding the loop.</p>minu shttp://de.mathworks.com/matlabcentral/profile/authors/3117597-minu-stag:de.mathworks.com,2005:Question/3085672016-10-22T08:48:10Z2016-10-23T03:48:28ZHow do I overlay an rgb image onto a background image?<p>Hello, I'm quite new to MATLAB and I've been trying to find a solution to what seems like a simple problem.</p><p>I have an RGB image and I would like to create a white border around it. In particular, I want the border at the bottom to be quite a bit larger to allow for some text. Then I will loop over all images in a directory and process them in that way.</p><p>I'm sure I have to create a background image whose dimensions are simply a bit larger than the rgb image, and then just overlay the rgb image onto the background. I need some help doing the overlaying part. Is there a simple way to do this?</p><p>Thanks</p>Lewis Dunnehttp://de.mathworks.com/matlabcentral/profile/authors/5804555-lewis-dunnetag:de.mathworks.com,2005:Question/3086772016-10-23T03:46:12Z2016-10-23T03:46:12ZI want to get accelerometer inputs from FRDM-K64F via bluetooth or serial to matlab for further processing<p>I want to get accelerometer inputs from FRDM-K64F via bluetooth or serial to matlab for further processing. How can I do it?</p><p>Thanks</p>Siddharth Pimprikarhttp://de.mathworks.com/matlabcentral/profile/authors/8976361-siddharth-pimprikartag:de.mathworks.com,2005:Question/3085732016-10-22T09:26:13Z2016-10-23T03:33:49ZImage replaced by graph in axes MATLAB GUIDE<p>Hi all. I have an issue regarding axes displaying image and graph as shown in the sequence of images attached below.</p><p>I want to retain my image in the respective axes and plot graph in another axes. For your information, my coding for plotting graph is generally plot(x,y) which I didn't specify the axes to be plotted.</p><p>I hope I explained well and look forward for any answer. Thanks in advance :D</p><img src = "/matlabcentral/answers/uploaded_files/61764/Capture.JPG"><img src = "/matlabcentral/answers/uploaded_files/61765/Capture1.JPG">James Thiemhttp://de.mathworks.com/matlabcentral/profile/authors/8722251-james-thiemtag:de.mathworks.com,2005:Question/2723872016-03-09T17:29:04Z2016-10-23T03:29:05ZCan I use a hidden test suite but still give students feedback?<p>In previous semesters when using Cody Coursework, I seem to remember that the assert function would display the message to students even though it was in a hidden test. This semester it seems as if the message from the assert function is no longer visible to students as feedback if the tests are hidden. Is there a way to have the tests remain hidden but give the students some feedback message pointing them to where their error is?</p><p>I feel like this is a major drawback to Cody if we can't give students feedback when using hidden tests.</p>William Martinhttp://de.mathworks.com/matlabcentral/profile/authors/6775628-william-martintag:de.mathworks.com,2005:Question/3086712016-10-23T00:55:26Z2016-10-23T03:22:19ZHow to use two -tail t-test?<p>I have two set of data (x and y)and I want to show that x is bigger than y by using the two-tail t-test. I know that the if I want to check the tail I need to type 'Tail','right','left', or 'both'. But I do not understand how to show this.</p>Weiyan Chenhttp://de.mathworks.com/matlabcentral/profile/authors/8658018-weiyan-chentag:de.mathworks.com,2005:Question/3086752016-10-23T03:20:33Z2016-10-23T03:20:33Zwhy triangulate function in Structure From Motion From Two Views does not not work ?<p>in matlab 2016a i use the triangulate function in matlab to get 3d 3D spatial coordinates from two photographs by using the example:(Structure From Motion From Two Views) but its not work , the error message is {Error in triangulate (line 10) A =[x1(1,i)*P1(3,:) - P1(1,:);
Error in StructureFromMotionExample (line 153) points3D = triangulate(matchedPoints1, matchedPoints2, camMatrix1, camMatrix2);} please can you helpe me</p>medo alihttp://de.mathworks.com/matlabcentral/profile/authors/5446740-medo-alitag:de.mathworks.com,2005:Question/3086662016-10-22T23:03:47Z2016-10-23T03:17:41ZHow can i print label numbers of each end point in such a way, so that I can see the endpoints label number with out zooming?<p>Here is my Image. I find the end points and label them. But I can not see the label numbers without zooming. Any suggestion how can i represent the label number so that i can see all the numbers without zooming? Here the problem is all the end points are too close so could not able to see the middle-end points clearly. Any idea how can i overcome this?</p><p>%</p><pre class="language-matlab">end point labeling
for k = 1 : numberOfEndpoints
thisx = x(k);
thisy = y(k);
%
% Get the label number of this segment
label = l(thisx, thisy);
% label1=l(thisx1, thisy1);
% plot(thisy, thisx,'o')
hold on
% plot(thisy1, thisx1,'o')
text( thisy,thisx,sprintf('%d ', label), 'color','r','fontsize',12);
</pre><pre class="language-matlab">% end
</pre><img src = "/matlabcentral/answers/uploaded_files/61804/untitled.jpg"><p>Please suggest me how can i print the label number o image so that i can see all the label number clearly</p>sheli whitsonhttp://de.mathworks.com/matlabcentral/profile/authors/7660658-sheli-whitsontag:de.mathworks.com,2005:Question/219272011-11-22T12:43:21Z2016-10-23T02:59:43ZDirect Linear Transformation for reconstructing 3D from two 2D photographs<p>We are trying to rescontruct 3D spatial coordinates from two photographs, by using DLT. Getting the transformation matrices for both view points isn't the problem, but getting the spatial coordinates from the two pictures seems very hard 'even with the solve commando'. Does somebody have an idea how we can solve this?</p><p>for more information about the method we are using. <a href="http://www.springerlink.com/content/pl32311419760523/fulltext.pdf">http://www.springerlink.com/content/pl32311419760523/fulltext.pdf</a></p><p>Appendix A (last page)</p>Tomhttp://de.mathworks.com/matlabcentral/profile/authors/2014297-tomtag:de.mathworks.com,2005:Question/3082602016-10-20T13:40:24Z2016-10-23T02:46:56Zhow to solve this error ? Error using horzcat Dimensions of matrices being concatenated are not consistent.<p>I found a code about implementation of genetic algorithm in TSP. it's running but suddenly this error appears :</p><pre class="language-matlab">Error using horzcat
Dimensions of matrices being concatenated are not consistent.
</pre><pre class="language-matlab">Error in elitism (line 15)
chrom = [fitness oldchrom;fitness2 newchrom];
</pre><p>i look for information about horzcat, it means that the array that i wanna combine dont have the same length?</p><p>can someone show me how to handle and solve this error. thank you so much!</p><p>this is code in elitism.m</p><pre class="language-matlab">% -------------------------------------------------------------------------
% Procedure of Elitism
% -------------------------------------------------------------------------
function chrom = elitism (fitness, newchrom, oldchrom, matrix_cost, nind, endNode, link_matrix)
% function name : elitism
% function input : 1. The fitness of old chromosomes
% 2. The new chromosomes
% 3. The previous / old chromosomes
% 4. The costs
% 5. The number of population
% 6. The destination node
% 7. The adjacency matrix of relationship between nodes
% function output : The chromosomes for the new generation
fitness2 = fitnessV(totalCost(newchrom,matrix_cost,nind,endNode,link_matrix));
chrom = [fitness oldchrom;fitness2 newchrom];
temp = sortrows(chrom);
chrom = temp((size(temp,1)-nind+1):size(temp,1),2:size(temp,2));
end
</pre>Khoirunnisya Zawawihttp://de.mathworks.com/matlabcentral/profile/authors/8832631-khoirunnisya-zawawitag:de.mathworks.com,2005:Question/3085892016-10-22T13:16:18Z2016-10-23T02:21:28ZGeneration of Random matrices in ascending order<p>Hi to all the matlab users. I want to generate 5 matrices of 3X3. the initial matrix is having all zeros. then the next 5 matrices that are generated should have random elements between 0 to pi but in ascending order at their respective loctions. e.g i am giving example
1st element of 1st matrix 0
1st element of 2nd matrix 0.0034
1st element of 3rd matrix 0.0139
1st element of 4th matrix 0.9861
1st element of 5th matrix 1.2345
1st element of 6th matrix 2.8904</p><p>similarly for other element.... Note: the element at same location of matrices are ascending. I hope I am able to clarify the question.</p><p>Regards.....</p>Offroad Jeephttp://de.mathworks.com/matlabcentral/profile/authors/4899830-offroad-jeeptag:de.mathworks.com,2005:Question/3086342016-10-22T20:00:57Z2016-10-23T02:03:02ZError using plot, invalid data argument<img src = "/matlabcentral/answers/uploaded_files/61794/matlab.JPG"><p>I am trying to plot real time data on appdesigner but i have always the same error. Hope somebody can help me!
Here is a picture with the error and part of the program. I make a vector with the data that i am receiving by serial, and a counter to make the y axis of the graphic.</p>Lucas Gutierrez Villas Boashttp://de.mathworks.com/matlabcentral/profile/authors/8452201-lucas-gutierrez-villas-boastag:de.mathworks.com,2005:Question/3086702016-10-23T00:34:48Z2016-10-23T01:31:03ZDSB-LC modulation<p>Hi,</p><p>I want to modulate a signal (that comes from an audio file) using DSB-LC with a 20kHz carrier.
However, I am not sure I am doing it right, as I expected a plot of my modulated signal different from what I've got.
Below is my code and plot of the message and modulated signal, both in time domain.</p><p>Code:</p><pre class="language-matlab">% message signal from a audio file
[sample,freq] = audioread('male2.wav');
sample = sample(:,1);
[num, c] = size(amostra);
T = 1/freq;
t = 0:T:(num-1)*T;
Mp = max(sample);
</pre><pre class="language-matlab">% carrier
carrier= cos (20000*pi*t);
Ts = 1/(48*10^3); % period of sampling of the carrier
tp = 0:Ts:(num-1)*T;
</pre><pre class="language-matlab">% modulation index (given by μ = Mp/Ac). In this case, μ = 1
Ac = Mp/1;
modulated = (Ac + sample).*carrier';
plot (t, modulated);
</pre><p>Message signal (time domain):</p><img src = "/matlabcentral/answers/uploaded_files/61806/a.png"><p>Modulated signal (time domain)</p><img src = "/matlabcentral/answers/uploaded_files/61807/Sem%20t%C3%ADtulo.png"><p>I don't think the modulated signal should be like that. Right?
I am supposed to do it for modulation indices of μ = 1, μ = 0.75 and μ = 0.5, but I am facing this problem right in the first case (μ = 1).</p><p>Any help will be appreciated.
Thank you.</p>Arquelauhttp://de.mathworks.com/matlabcentral/profile/authors/9040444-arquelautag:de.mathworks.com,2005:Question/3086072016-10-22T16:14:37Z2016-10-23T01:30:25ZHow do I vectorize this code below?<pre> if(y+1 <= length(B))
if(sum(ismember(closed(:,1:2),[x,y+1],'rows'))== 0)
cost = hMap(x,y)+ B(x,y+1);
if(cost< hMap(x,y+1))
hMap(x,y+1) = cost;
open = [open;x,y+1,cost];
end
end
end</pre>Emmanuelhttp://de.mathworks.com/matlabcentral/profile/authors/4160343-emmanueltag:de.mathworks.com,2005:Question/3086682016-10-22T23:30:31Z2016-10-23T01:27:52ZHow to create an anonymous function with a lot of variables?<p>I would like to create an anonymous function and use it in fmincon to find vector x. For instance if I want to have 3 variables I would create function (simple example) like this:</p><pre class="language-matlab">fun = @(x)(x(1)+x(2)+x(3));
</pre><pre class="language-matlab">x = fmincon(fun,x0,A,b);
</pre><p>I have to create something similar but with way more elements of vector x. I was trying to create a for loop and use symsum, but neither of those worked. Is there a possible solution for that problem?</p>sycXZORhttp://de.mathworks.com/matlabcentral/profile/authors/9041919-sycxzortag:de.mathworks.com,2005:Question/3086232016-10-22T18:41:06Z2016-10-23T01:25:40ZFmincon: How to use constraints irrelevant to the obj function?<p>I would like to minimize an objective function and use constraints of variables that are not included in the objective function.
Is there a way to add them somehow independently (so the don't play an active role in the minimization let's say) in the objective function to be able to use them later in the constraints?</p>Lampros Konstantinouhttp://de.mathworks.com/matlabcentral/profile/authors/9040883-lampros-konstantinoutag:de.mathworks.com,2005:Question/3086632016-10-22T22:51:50Z2016-10-23T01:22:31ZHow to save a loop data<p>Hi guys, I have a for loop, but every iteration overwrites the variable(max_run), and I have only the final data left. How can I save data from every loop? I saw some other questions like my issue, but I always get an error"Improper assignment with</p><pre class="language-matlab">%% BPSK Generation
clear all; close all; clc;
N = 2*10^4; % number of bits or symbols
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1
</pre><pre class="language-matlab">%% Prepare transmitted signal
</pre><pre class="language-matlab">m=2; % oversampling factor
beta=0.3; % rolloff parameter for SRRC
l=100; % 1/2 length of pulse shape (in symbols)
chan=[1]; % T/m "channel"
toffset=-0.5; % initial timing offset
pulshap=srrc(l,beta,m,toffset); % SRRC pulse shape
sup=zeros(1,N*m); % upsample the data by placing...
sup(1:m:end)=s; % ... p zeros between each data point
hh=conv(pulshap,sup); % ... and pulse shape
r1=conv(hh,chan); % ... to get received signal
</pre><pre class="language-matlab">%% Noise Generation
</pre><pre class="language-matlab">SNRdB=1:2:13; % Signal to Noise Ratio
SNR=10.^(SNRdB/10);
</pre><pre class="language-matlab">for cv=1:length(SNR);
</pre><pre class="language-matlab">no=sqrt((1/SNR(cv)))*randn(1,40400); % Noise generation
r=r1+no; % Adding the noise to the received signal
</pre><pre> %% Matched Filter & Convolution process</pre><pre> matchfilt=srrc(l,beta,m,0); % filter = pulse shape
x=conv(r,matchfilt); % convolve signal with matched filter</pre><pre> %% Run clock recovery algorithm</pre><pre> tnow=2*l*m+1; tau=0; xs=zeros(1,N); % initialize variables
tausave=zeros(1,N); tausave(1)=tau; i=0;
mu=0.05; % algorithm stepsize
delta=0.1; % time for derivative</pre><pre> while tnow<length(x)-2*l*m % run iteration
i=i+1;
xs(i)=interpsinc(x,tnow+tau,l); % interpolated value at tnow+tau
x_deltap=interpsinc(x,tnow+tau+delta,l); % get value to the right
x_deltam=interpsinc(x,tnow+tau-delta,l); % get value to the left
dx=x_deltap-x_deltam; % calculate numerical derivative
tau=tau+mu*dx*xs(i); % alg update (energy)
tnow=tnow+m; tausave(i)=tau; % save for plotting
indexmin = find(tausave >= 0.5); % finding iteration value..
max_run = min(indexmin) % automaticlly
end</pre><pre> % Plot results
figure, subplot(2,1,1), plot(xs(1:i-2),'b.');
legend([ 'SNR=' int2str(SNR(cv))]); % plot constellation diagram
title('constellation diagram');
ylabel('estimated symbol values')
subplot(2,1,2), plot(tausave(1:i-2))
ylabel('offset estimates'), xlabel('iterations')
legend([ 'SNR=' int2str(SNR(cv))]);</pre><pre class="language-matlab">end
</pre>Bahaa Algeboryhttp://de.mathworks.com/matlabcentral/profile/authors/8477975-bahaa-algeborytag:de.mathworks.com,2005:Question/3086622016-10-22T22:45:57Z2016-10-23T01:01:30Zsolve an equation with elements from matrix<p>Hi</p><p>I have a matrix Y [2x2]</p><p>I have an equation x^2+2*x+Y=0</p><p>I want to solve for x using all the values from Y to get a solution matrix. How can I do this?</p><p>Please help. Thanks in advance.</p>Krishnendhu Prakasanhttp://de.mathworks.com/matlabcentral/profile/authors/6551900-krishnendhu-prakasantag:de.mathworks.com,2005:Question/1246252014-04-05T19:17:55Z2016-10-23T00:51:36ZTaylor series calculation of sin(x)<p>hello! The problem I am having trouble with is this:</p><p>Calculate g(x) = sin(x) using the Taylor series expansion for a given value of x.
Solve for g(pi/3) using 5, 10, 20 and 100 terms in the Taylor series (use a
loop)</p><p>So I tried the following in the script editor:</p><pre> clear
clc</pre><pre> n = input('Enter number of iiterations (n): ' );
x = pi/3;
y = zeros(1,n);</pre><pre> for i = 1:n
y(i) = (-1)^i*x^(2*i+1)/factorial(2*i+1);
end</pre><pre> SINx = sum(y);</pre><p>however when i run the script, the value of SINx that I get isn't what sin(pi/3) is supposed to be and I just can't figure out why.</p>Andyhttp://de.mathworks.com/matlabcentral/profile/authors/5179070-andytag:de.mathworks.com,2005:Question/3085442016-10-22T01:07:21Z2016-10-23T00:39:40ZNodes belongto which Graph?<p>Dear matlab,</p><p>Please let me know if we can findout from the graph table which nodes belong to which graph, as in G.Edges in the graph function only shows connected nodes and linkages and weights, i.e node1 node2 weight</p><p>Can we have information that shows node and graph it belongs to, ex node1 graph1
node2 graph1
node3 graph2
node4 graph2
node5 graph2
node6 graph3</p>Shawn Fernandeshttp://de.mathworks.com/matlabcentral/profile/authors/8852320-shawn-fernandestag:de.mathworks.com,2005:Question/3051432016-09-29T23:30:29Z2016-10-23T00:29:39ZCreating a standalone executable with Vehicle Network Toolbox commands<p>Hi everyone,</p><p>I'm trying to build a standalone app that use "canMessageImport" to pull in an ACSII file from Vector and parses for certain signals I want. I am getting an error that the app cannot import the ASCII file even though I do not get that error when running the M scripts from the command prompt.</p><p>Any ideas as to what could be wrong? Thanks!</p>John Fhttp://de.mathworks.com/matlabcentral/profile/authors/2702317-john-ftag:de.mathworks.com,2005:Question/2660842016-02-01T15:22:13Z2016-10-23T00:27:48Zsimulink NI USB-6009 device<p>I'm using matlab2015b(64bit) on windows7 and trying to get some reading from my NatianalInstruments USB-6009 using simulink. Using Labview I get data, so I know the device is working. In simulink I'm unable to find a Realtime block for this device. There are plenty PCI based NI solutions there, but no USB based. Could someone please point me in the right direction, I have been searching the last 4 hours on this site.</p>Erikhttp://de.mathworks.com/matlabcentral/profile/authors/2232996-eriktag:de.mathworks.com,2005:Question/3069282016-10-12T11:58:55Z2016-10-23T00:22:31ZTmtool don't recognize the tcp/ip on a computer, but does it on another one<p>Hello,</p><p>I write here today because I try to import a software from a laptop to a desktop computer. The laptop works on Windows 7 Pro 64bits and the desktop one on Windows 10 32bits. I developed a network using a router and ethernet cables. I also installed a software from my instruments (Tektronix function generators) which permits to watch what connections are available. MATLAB is the 2007b version.</p><p>On the laptop, using the Tektronix software, or trying to ping on a command window, or scanning for instrument with the tmtool, each time I can see my 2 connections and I can communicate with the instruments.
BUT, with the desktop computer, all work except MATLAB : the tmtool don't recognize any connection, and when I try to create a visa or tcpip object, I have an error message which tell me I probably didn't installed properly a driver.
But, when I look for the matlab driver with the instrhwinfo('matlab') function, I have correctly the drivers I also use on the laptop.</p><p>I don't find why the tmtool is not working. I look the firewall of windows and the antivirus but no problems here. I don't know where to search now.</p><p>I thank you in advance for each piece of advise you could give me.</p><p>PS: can we ping from MATLAB directly?</p>Mathieuhttp://de.mathworks.com/matlabcentral/profile/authors/3840118-mathieutag:de.mathworks.com,2005:Question/3086692016-10-22T23:46:18Z2016-10-22T23:52:16Z** Extreme Beginner** extract field values from multiple rows in structure<p>Hey guys, very inexperienced with MATLAB.</p><p>I'm essentially trying to run this, but for all 12 rows, as oppose to the 1(z(1)) listed.</p><pre class="language-matlab">function [OUTPUT] = soma(z);
present = find(z(1).theSubject.trials.task);
response = find(z(1).theData.rt>0);
original = z(1).theData.rt([response]);
corrections = original + 0.5;
OUTPUT = struct('present', present,'response', response,'original', original, 'corrections', corrections);
end
</pre><p>Essentially, I just need to add 0.5 all non-zero elements in the .rt field.</p><p>Is possible without a for loop?</p><p>Thanks</p>Mathias Gregersen-Cisewskihttp://de.mathworks.com/matlabcentral/profile/authors/8539141-mathias-gregersen-cisewskitag:de.mathworks.com,2005:Question/3086642016-10-22T22:57:01Z2016-10-22T23:44:37Zcan somebody help me to generate a confusion matrix for this multisvm code?<p>I have been trying to plot a confusion matrix for this svm code but im reaching nowhere,so the purpose of my code is to classify my 95 images into 3 classes, i have made the training_label which is the label of every image.then i don't know how to generate the confusion matrix. here is the code</p><pre class="language-matlab">close all
clear all
clc
srcFiles = dir('E:\sense\cata2\cata\all\*.jpg');
for i = 1 : length(srcFiles)
filename = strcat('E:\sense\cata2\cata\all\',srcFiles(i).name);
</pre><pre class="language-matlab">Img = imread(filename);
Img = imresize(Img,[256,256]);
%figure, imshow(Img); title('Image');
</pre><pre class="language-matlab">% Enhance Contrast
I = imadjust(Img,stretchlim(Img));
figure, imshow(I);title('Contrast Enhanced');
</pre><pre class="language-matlab">% Extract Features from query image
[Feature_Vector] = Extract_FeaturesofSoilforall(I);
whos Feature_Vector
</pre><pre class="language-matlab">% Load Training Features
</pre><pre class="language-matlab">[X,T] = cataractdataset;
TrainFeat = X;
Train_Label = T;
test = Feature_Vector;
result = multisvm(TrainFeat,Train_Label,test)
disp(result)
</pre><pre class="language-matlab">if result == 1
helpdlg(' grade1');
disp(' grade1 ');
elseif result == 2
helpdlg(' last ');
disp('last');
elseif result == 3
helpdlg('normal');
disp(' normal ');
</pre><pre class="language-matlab">end
confMat = confusionmat(,test )
end
</pre>Hadeer tawfikhttp://de.mathworks.com/matlabcentral/profile/authors/3944762-hadeer-tawfiktag:de.mathworks.com,2005:Question/1007922009-06-27T01:11:00Z2016-10-22T23:42:12ZIn MATLAB, how do I obtain information about my screen resolution and screen size?<p>Using MATLAB, I want to obtain information about my screen resolution and screen size.</p>MathWorks Support Teamhttp://de.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:de.mathworks.com,2005:Question/3085582016-10-22T06:50:44Z2016-10-22T23:28:53ZText File Reading with Text and Numbers<p>I am trying to extract the only numerical data from the attached data file.</p><img src = "/matlabcentral/answers/uploaded_files/61760/ex2.JPG"><p>I am using this code:</p><pre class="language-matlab">clc
clear all
fid = fopen('Ex2.txt','r'); %# Open the file
results = textscan(fid,[repmat(' %*s',1,6) ... %# Read 5 strings, ignoring them
'%f %f'], ... %# Read 2 numeric values
'Whitespace','\t\n\r',... %# Add \n and \r as whitespace
'CollectOutput',true); %# Collect numeric values
fclose(fid); %# Close the file
results1 = results{1};
</pre><p>But i am not getting the required data.</p><p>Please help.</p><p>Thanks</p>Jawad Yousafhttp://de.mathworks.com/matlabcentral/profile/authors/6242356-jawad-yousaftag:de.mathworks.com,2005:Question/3085312016-10-21T22:09:48Z2016-10-22T23:26:48Zhow to write zoom code with scale for an rgb image <p>i write this one for gray image but i looking for rgb's too (nearest neighbor)</p><pre class="language-matlab">I1=[50 80 100 ; 115 21 90 ;32 50 160];
S=2 ;
[M , N]=size(I1);
M2=S*M;
N2=S*N;
I2=zeros(M2 , N2);
for i =1:M2
for j = 1:N2
x =i/S;
y=j/S;
x2=round(x);
y2=round(y);
if (x2<1)||(x2>M)||(y2<1)||(y2>N)
I2(i , j)=0;
else
I2(i,j)=I1(x2 ,y2);
end
end
</pre><pre class="language-matlab">end
</pre>alireza kooshafarhttp://de.mathworks.com/matlabcentral/profile/authors/7278011-alireza-kooshafartag:de.mathworks.com,2005:Question/3085572016-10-22T06:20:36Z2016-10-22T23:25:05ZNeed to export a 3D model <p>I have set of images and i have just considered the boundary of the image. In that boundary, i have obtained points as x and y coordinates, which shown below:</p><pre class="language-matlab">x= sortedx(i);
y=sortedy(i);
</pre><p>then i have the z coordinate as below:</p><pre> z=2*ones(1,length(line));</pre><p>(Note that z is the slice thickness which apparently 2mm, here)</p><p>My question is i have stacked mat files of above mentioned boundary images. Now, my intention is to export a 3D model to paraview by converting it to VTK format. Unfortunately, out of many mat to vtk conversion functions,i was not able to solve my issue). How can i export my 3D model?</p><p>Can someone pls help.</p>Chathuhttp://de.mathworks.com/matlabcentral/profile/authors/4838921-chathutag:de.mathworks.com,2005:Question/2174442015-05-18T20:55:53Z2016-10-22T23:14:08ZMatlab jokes or puns<p>Are there any good Matlab jokes? I don't mean <tt>why</tt> or any other Easter eggs, I mean good jokes involving Matlab. Actually, that <tt>bar</tt> may be a bit too high. Any jokes, good or bad, let's hear 'em.</p>Chad Greenehttp://de.mathworks.com/matlabcentral/profile/authors/1062128-chad-greenetag:de.mathworks.com,2005:Question/3086612016-10-22T22:40:55Z2016-10-22T22:46:27ZHi guys, I have a for loop, but every iteration overwrites the variable(max_run), and I have only the final data left.. How can I save data from every loop? I saw some other questions like my issue, but I always get an error"Improper assignment with<p>%% BPSK Generation
clear all; close all; clc;
N = 2*10^4; % number of bits or symbols
ip = rand(1,N)>0.5; % generating 0,1 with equal probability
s = 2*ip-1; % BPSK modulation 0 -> -1; 1 -> 1</p><p>%% Prepare transmitted signal</p><p>m=2; % oversampling factor
beta=0.3; % rolloff parameter for SRRC
l=100; % 1/2 length of pulse shape (in symbols)
chan=[1]; % T/m "channel"
toffset=-0.5; % initial timing offset
pulshap=srrc(l,beta,m,toffset); % SRRC pulse shape
sup=zeros(1,N*m); % upsample the data by placing...
sup(1:m:end)=s; % ... p zeros between each data point
hh=conv(pulshap,sup); % ... and pulse shape
r1=conv(hh,chan); % ... to get received signal</p><p>%% Noise Generation</p><p>SNRdB=1:2:13; % Signal to Noise Ratio
SNR=10.^(SNRdB/10);</p><p>for cv=1:length(SNR);</p><p>no=sqrt((1/SNR(cv)))*randn(1,40400); % Noise generation
r=r1+no; % Adding the noise to the received signal</p><pre> %% Matched Filter & Convolution process</pre><pre> matchfilt=srrc(l,beta,m,0); % filter = pulse shape
x=conv(r,matchfilt); % convolve signal with matched filter</pre><pre> %% Run clock recovery algorithm</pre><pre> tnow=2*l*m+1; tau=0; xs=zeros(1,N); % initialize variables
tausave=zeros(1,N); tausave(1)=tau; i=0;
mu=0.05; % algorithm stepsize
delta=0.1; % time for derivative</pre><pre> while tnow<length(x)-2*l*m % run iteration
i=i+1;
xs(i)=interpsinc(x,tnow+tau,l); % interpolated value at tnow+tau
x_deltap=interpsinc(x,tnow+tau+delta,l); % get value to the right
x_deltam=interpsinc(x,tnow+tau-delta,l); % get value to the left
dx=x_deltap-x_deltam; % calculate numerical derivative
tau=tau+mu*dx*xs(i); % alg update (energy)
tnow=tnow+m; tausave(i)=tau; % save for plotting
indexmin = find(tausave >= 0.5); % finding iteration value..
max_run = min(indexmin) % automaticlly
end</pre><pre> % Plot results
figure, subplot(2,1,1), plot(xs(1:i-2),'b.');
legend([ 'SNR=' int2str(SNR(cv))]); % plot constellation diagram
title('constellation diagram');
ylabel('estimated symbol values')
subplot(2,1,2), plot(tausave(1:i-2))
ylabel('offset estimates'), xlabel('iterations')
legend([ 'SNR=' int2str(SNR(cv))]);</pre><p>end</p>Bahaa Algeboryhttp://de.mathworks.com/matlabcentral/profile/authors/8477975-bahaa-algeborytag:de.mathworks.com,2005:Question/3086592016-10-22T21:37:38Z2016-10-22T22:37:37ZCreating matrix nested for loop<p>I need to write a matrix where the first column has the varying mass of an ODE, the second to n-th column all the y(t) values of that ODE. I tried to solve this with a nested for loop but somehow fail so hard eventhough I am sure it is pretty easy.</p><pre class="language-matlab">for row_index = 1:10
for col_index = 1:length(time)
Matrix(row_index,column_index) = [mass(row_index)];
end
end
</pre><p>Somehow something after "[mass(row_index)]" is missing or do you know a way to make it more elegant?</p><p>Thanks in advance!</p>Detoxhttp://de.mathworks.com/matlabcentral/profile/authors/3214754-detoxtag:de.mathworks.com,2005:Question/3085472016-10-22T02:00:55Z2016-10-22T22:10:31ZRobot Path Planning using grid<p>Trying to plot a path for a robot from start to goal. I get error in the 2 "for" for x,ystatements. Get error "Subscript indices must either be real positive integers or logicals". Program is:</p><pre class="language-matlab">SearchSolution=[1.0000 0.9705 0.9513 0.9471 0.9557 0.9661 0.9770 0.9883;...
1.0000 0.9629 0.9403 0.9418 0.9629 0.9744 0.9833 0.9916;...
1.0000 0.9581 0.9350 0.9451 1.0000 1.0000 1.0000 1.0000;...
1.0000 0.9534 0.9219 0.9271 1.0000 1.0000 1.0000 1.0000;...
1.0000 0.9487 0.8997 0.8593 0.8349 0.8100 0.8635 0.9331;...
1.0000 0.9574 0.8886 0.8000 0.6815 0.5499 0.7154 0.8711;...
1.0000 1.0000 0.9171 0.7871 0.5575 0 0.5830 0.8391];
</pre><pre class="language-matlab">OptimalPath=[2,7];
</pre><pre class="language-matlab">CurrentPos=[2,7];
</pre><pre class="language-matlab">min=99;
</pre><pre class="language-matlab">SearchGoal=[7,6];
</pre><pre class="language-matlab">while not(isequal(CurrentPos,SearchGoal))
</pre><pre> for x=SearchSolution(OptimalPath(end,1)-1:OptimalPath(end,1)+1), </pre><pre> for y=SearchSolution(OptimalPath(end,2)-1:OptimalPath(end,2)+1),</pre><pre> [r,c] = find(min == min(SearchSolution(:)));</pre><pre> end</pre><pre> end</pre><pre> CurrentPos=[r,c]; </pre><pre> OptimalPath=[OptimalPath;CurrentPos];</pre><pre> end</pre><pre> end</pre>Kenhttp://de.mathworks.com/matlabcentral/profile/authors/1541314-ken