matlab

What are the second-moments of a region?

I'm currently working on replicating some of the functionality of Matlab's regionprops function in Octave. However, I have a bit of a hangup on a subset of the functionality. The 'Eccentricity', 'MajorAxisLength', 'MinorAxisLength' and 'Orientation' properties are my sticking point. In the documentation, they all derive from "...the e...

Changing multiple .fig files in Matlab systematically

I want to browse a directory where many Matlab GUI's (.fig files and their related .m files) are stored and change them systematically. For each, I want to search for a certain popup menu and, if it exists, delete some specific options. I usually use get() and set() or similar functions to fiddle with GUI's, but these functions require ...

tformfwd and tforminv - what's the difference?

Suppose I have an arbitrary transformation matrix A such as, A = 0.9966 0.0007 -6.5625 0.0027 0.9938 1.0598 0 0 1.0000 And a set of points such that their x and y coordinates are represented by X and Y respectively. And suppose, [Xf Yf] = tformfwd(maketform('projective',A),X,Y); Now, [Xff...

Dimension Reduction

I'm trying to reduce a high-dimension dataset to 2-D. However, I don't have access to the whole dataset upfront. So, I'd like to generate a function that takes an N-dimensional vector and returns a 2-dimensional vector, such that if I give it to vectors that are close in N-dimensional space, the results are close in 2-dimensional space...

Problem (bug?) loading hexadecimal data into MATLAB

I'm trying to load the following ascii file into MATLAB using load() % some comment 1 0xc661 2 0xd661 3 0xe661 (This is actually a simplified file. The actual file I'm trying to load contains an undefined number of columns and an undefined number of comment lines at the beginning, which is why the load function was attractive) For s...

Warning: Ignoring excess mask dialog entries in:

I'm having serious trouble debugging the following Matlab Warning: Warning: Ignoring excess mask dialog entries in: (path to block under mask of block of Simulink model I'm running) Does anybody know what it even means? What are "mask dialog entries"? ...

Faster version of dec2bin function for converting many elements?

I am reading a bitmap file and converting each of the RGB values ranging from 0 to 255 to binary. So a 240 by 320 bitmap will have 230400 RGB values to convert. The original dec2bin function was too slow, so I wrote my own as I know my value will always be between 0 to 255. But going through 230400 values will still take approx. 6sec o...

Octave: testing functions over a Range in Lists or like with For-loops?

I want to see the values of the function y(x) with different values of x, where y(x) < 5: y = abs(x)+abs(x+2)-5 How can I do it? ...

Matrix of unknown length in MATLAB?

I'm trying to set up a zero matrix of variable length with two columns into which I can output the results of a while loop (with the intention of using it to store the step data from Euler's method with adjusted time-steps). The length will be determined by the number of iterations of the loop. I'm wondering if there's a way I can do t...

RSSI for Bluetooth

Can any one help me to write code for RSSI in Bluetooth. any tool and techniques used for this to find it easily ...

MATLAB Piecewise Functions + Vector Manipulation

I would like to write a program which plots the points on top of a semicircle on a certain interval and a straight line everywhere else. Something like this: __n__. I defined a time domain, which was stored as a vector (t = 0:0.01:5). I assumed that I could define the points on the top of the semicircle using elements of the time vector...

Nearest-neighbor interpolation algorithm in MATLAB

I am trying to write my own function for scaling up an input image by using the Nearest-neighbor interpolation algorithm. The bad part is I am able to see how it works but cannot find the algorithm itself. I will be grateful for any help. Here's what I tried for scaling up the input image by a factor of 2: function output = nearest(inp...

Issues with programming General Cross Correlation (GCC) in matlab

I have a question with regards to programming a Generalised Cross Correlation (GCC) function in Matlab for sound localisation experiments, to reduce the effects of reverberation. I found some sample code that implements GCC: http://webscripts.softpedia.com/script/Scientific-Engineering-Ruby/Signal-Processing/Generalized-Cross-Correlatio...

Merge a 1 x N array to a 1 x 1 array without using loop in MATLAB

Hi, I have a 1 x N double array and I would like to merge it to become a 1 x 1 array. E.g. K = [0,1,1,1]; I want K to become K = [0111]; How do I do it? ...

What is better for running Monte Carlo simulations MATLAB or Mathematica?

I am doing a research project and need to use Monte Carlo simulation. I want to know, what is better to use: MATLAB or Mathematica? I have used MATLAB before but have heard good things about Mathematica. ...

Converting binary to decimal without using loop

Hi, I have a 12bit binary that I need to convert to decimal. E.g. A = [0,1,1,0,0,0,0,0,1,1,0,0]; Bit 1 is the MSB, Bit 12 is the LSB . How do I do it? ...

Displaying series of bitmap in form of a movie

Hi, I have a series of bitmap files that I want to display on a GUI, like a movie. But the files will not be available all at once, as the incoming bitmaps need to be demodulated. E.g Bitmap -> Modulate -> Channel -> Demodulate -> Bitmap -> Display Now I have 2 questions: 1) Does any of the matlab commands read from a buffer (maybe ...

how to read digits from text file and save it in an array "using MATLAB or JAVA" ?

hi, I have similar problem with little changes, which is: I have text file contain large number of lines with different sizes "i.e. not all lines has same length" each line contain integers only. as an example A.txt = 4 6 4 1 2 2 5 7 7 0 9 5 5 3 2 43 3 32 9 0 1 3 1 3 4 5 6 7 4 34 5 8 9 0 7 6 2 4 5 6 6 7 5 4 3 2 21 4 9 8 4 2 1 ...

How to flip the definition of edges(1) and edges(end) for the histc function in MATLAB?

In MATLAB: n = histc(x,edges); is defined to behave as follows: n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1). The last bin counts any values of x that match edges(end). Is there any way to flip the end behavior such that n(1) counts any values of x that match edges(1), and n(end) counts the values x(i) that ...

How does this MATLAB code work? (probabilities and random sequences)

I saw this code in a comment for the article "Never-ending Shuffled Sequence". I understand the basic premise, but I don't know how it works. The biggest explanation I need is of the first two lines of the while loop. (Because it is written in MATLAB I can only guess at how this code functions.) probabilities = [1 1 1 1 1 1]; unrandomn...