matlab

Drawing a polygon around groups of datapoints in MATLAB

I have a set of datapoints each of which belongs to a certain cluster (group). I need to draw a polygon around each of these clusters. Does anyone knows how to do it? It doesn't matter if I use or not use the actual datapoints for drawing the polygon. I just need them to be wrapped in a polygon. ...

Select all points in a matrix within 30m of another point

So if you look at my other posts, it's no surprise I'm building a robot that can collect data in a forest, and stick it on a map. We have algorithms that can detect tree centers and trunk diameters and can stick them on a cartesian XY plane. We're planning to use certain 'key' trees as natural landmarks for localizing the robot, using ...

Find location using only distance and bearing?

Triangulation works by checking your angle to three KNOWN targets. "I know the that's the Lighthouse of Alexandria, it's located here (X,Y) on a map, and it's to my right at 90 degrees." Repeat 2 more times for different targets and angles. Trilateration works by checking your distance from three KNOWN targets. "I know the that's the ...

How to calculate the current index?

Hi, I have written an algorithm which iteratively solves the problem. The first iteration consists of 6 steps and all the following iterations consist of 5 steps (first step is skipped). What I want to calculate is the current (local) step in the iteration from current global step. For example if there are 41 steps in total which mean...

How do I shear an image in MATLAB without using built-in functions?

I want a method to shear an image without using the built-in functions (methods) of MATLAB. How can I do this? ...

Shading an area boundered by a curve

What would be the easiest way to lightly shade (or hatch; or anything to set it different from the rest) an area in a plot(), below a curve y=x^2, for example ? x = 0:pi/10:2*pi; y = x.^2.; plot(x,y); ...

.NET coupled with MATLAB or R?

I'm writing a program in .NET that will need to utilize the statistical and data analysis functions of R or MATLAB. I have used R but am now contemplating moving to MATLAB since it has a .Net compiler while R can only interface via COM objects. Can anyone recommend going either way? I know MATLAB is infinitely more expensive than R (sinc...

If a MATLAB function returns a variable number of values, how can I get all of them as a cell array?

I am writing a function to remove some values from a cell array, like so: function left = remove(cells, item); left = cells{cellfun(@(i) ~isequal(item, i), cells)}; But when I run this, left has only the first value, as the call to cells{} with a logical array returns all of the matching cells as separate values. How do I group these...

Calling Matlab's MLApp.MLAppClass.FEval from F#

Matlab provides a COM interface that supports remote execution of arbitrary functions (and code snippets). In particular, it has an Feval method that calls a given Matlab function. The third parameter to this method, pvarArgOut, has COM type VARIANT*, and appears in the Visual Studio F# editor as an argument of type: pvarArgOut: byref<o...

Matlab: Adding symbols to figure

Hi, Below is the user interface I have created to simulate LDPC coding and decoding The code sequence is decoded iteratively by passing values between the left and right nodes through the connections. The first thing it would be good to add in order to improve visualization is to add arrows to the connections in the direction of passi...

Sorting in Matlab

Hi, I would like to sort elements in a comma-separated list. The elements in the list are structs and I would like the list to be sorted according to one of the fields in the struct. For example, given the following code: L = {struct('obs', [1 2 3 4], 'n', 4), struct('obs', [6 7 5 3], 'n', 2)}; I would want to have a way to sort L ...

GPIB connection to external device using MATLAB

Is there a way to establish a GPIB connection using MATLAB without the instrument control Tool box? (I don't have it). Also is there a way for MATLAB to know what the external device's RS232 parameter values are ( Baud rate, stop bit etc..). For the RS232 connection I have the following code: % This function is meant to send commands to...

determine whether matlab license is server- or user-based

I've noticed that there are many different flavors of MATLAB available. Some licenses require constant contact with the licensing server, and if disconnected the client will show some message like "unable to contact licensing server, will quit if connection not re-established in X minutes." Others are stand-alone installs, without such l...

For loop to extract info from a structure doesn't work?

I have a structure in matlab that has a value of <1x1 struct>., its name is figurelist. Inside that structure, there is a field called images. Inside images, I have 25 images that have the name img1, img2, img3, ..... , img25. Now I made a for loop to extract those images, I basically did: For K=1:25 image(figurelist.images.imgK)...

can i changed for loop index variable inside the loop in Matlab???

hi every one. i need to change my loop variable inside the iterationa as ihave to acces array elements in the loop which is changing w.r.t size inside the loop. ashort piece of code is that: que=[]; que=[2,3,4]; global len; len=size(que,2) x=4; for i=1:len if x<=10 que(x)= 5; len=size(que,2) x=x+1; end end que a...

How to display matrix in a scrollable edit control?

Hi, I have tried to display the matrix values in edit controls the following way: LrOut = num2str(Lr(:, :, currentPosition)); LqOut = num2str(Lq(:, :, currentPosition)); set(handles.txtLr, 'String', LrOut); set(handles.txtLq, 'String', LqOut); where txtLq and txtLr are edit controls: When the code above is executed th...

what algorithm good for image matching?

what algorithm good for image matching?to match different between two image ...

How to import and plot data from a .mat file to x and y variables ?

Hi there, I have a problem that I thought I knew how I can fix it, but apparently I failed .. I got a .mat file that I created, it has 2 columns and 25 rows of numbers. I would like to do a loop to get each value in the first column and put it in the X value, and the second column in the Y value. I then need to plot the points on the g...

please help me Assignment has more non-singleton rhs dimensions than non-singleton

I have the following error in my code Assignment has more non-singleton rhs dimensions than non-singleton This is the code: string =['d:\face\face\ffw' int2str(r) '_' int2str(Sel(nSelRow,t)) '.bmp']; A = imread(string); B = im2double(A); Train_Dat(:,:,s)=B; Update 1: When I updated the code we got new error in the next r...

Using polyfit to predict where the object falls ?

Hi there, I have information of an object being thrown at a parabolic pattern. There are 30 images in total taken at specific intervals from the start position till the end. Now I have managed to extract the x,y coordinates of the object being thrown in all 30 images... I think that using polyfit (or maybe polyval ? ) may help me predi...