matlab

Best way to organize MATLAB classes?

MATLAB has two ways of organizing classes: @-directories: @ClassName\ ClassName.m Method1.m Method2.m Single files: ClassName.m: classdef ClassName methods % all methods included here end end The first style existed before the new classdef syntax, but seems to be a more structured way of doing things....

Skip reading strings in matlab

Is there is easy command in matlab which prevents program from crashing when it reads characters? I use xlsread to read a (20 400) matrix data , the first row and column get disregarded as they have headers, so that: data = xlsread ( ' C:\file.xls') results in data with a size of (19 399). I have a problem, some cells have missing...

Changing the x-axis of seqlogo figures in MATLAB

I'm making a large number of seqlogos programmatically. They are hundreds of columns wide and so running a seqlogo normally creates letters that are too thin to see. I've noticed that I only care about a few of these columns (not necessarily consecutive columns) ... most are noise but some are highly conserved. I use something like this...

SIFT algorithm in Matlab

I am looking for a Matlab implementation of the SIFT algorithm. ...

matlab v.s. simulink in digital image processing?

Hi is there anything i can do with code in matlab for digital image processing that i can't do with simulink's digital image processing toolbox or vice versa??? what difference is there between the two ? thank you ...

How to setup matlabpool for multiple processors?

I just setup a Extra Large Heavy Computation EC2 instance to throw it at my Genetic Algorithms problem, hoping to speed up things. This instance has 8 Intel Xeon processors (around 2.4Ghz each) and 7 Gigs of RAM. On my machine I have an Intel Core Duo, and matlab is able to work with my two cores just fine by runinng: matlabpool open ...

Matlab Simulink: Transfer Function

I am trying to model a transfer function block for let's say 1/(s+1). I am having a hard time coming up with proper search terms for it, hence having trouble finding out how I can achieve this on the Internet. What is the easiest way to implement a block for a transfer function in Simulink? Thanks in advance. ...

Simulink: type consistency errors

Using this Simulink model file as a reference, I'm trying to figure out the two following errors: I have no idea what has gone wrong with the data type consistency/conversion problems. Do you know what the error messages mean exactly in the context of a model? It would be great to get an interpretation of the problem to solve it. Tha...

MATLAB Builder NE (.NET Assembly) Data type question

I am using MATLAB Builder NE (MATLAB's integrated .NET assembly builder), but I am having an issue with data types. I have compiled a small, very simple, function in MATLAB and build it for .NET. I am able to call the namespace and even the function just fine. However, my function returns a value, and MATLAB defaults to returning it ...

uncomplete ezplot drawing

why when i use ezplot in for example [1 1.5] interval, a discontinuity will appear in some pieces of lines but when i use a closer interval like [1.3 1.5], the discontinuity will be annihilated? ...

How do I force ode45 to take steps of exactly 0.01 on the T axis?

I'm using Matlab to solve a differential equation. I want to force ode45 to take constant steps, so it always increments 0.01 on the T axis while solving the equation. How do I do this? ode45 is consistently taking optimized, random steps, and I can't seem to work out how to make it take consistent, small steps of 0.01. Here is the code...

Matlab - binary vector with high concentration of 1s (or 0s)

What's the best way to generate a number X of random binary vectors of size N with concentration of 1s (or, simmetrically, of 0s) that spans from very low to very high? Using randint or unidrnd (as in this question) will generate binary vectors with uniform distributions, which is not what I need in this case. Any help appreciated! ...

How to acquire still webcam image

I need some help deciding what to use to acquire an image from a webcam. I want to acquire a single image. I know you can typically acquire a still image at a higher resolution than a single video frame. Currently, I am using MATLAB's image acquisition toolbox.. which apparently only supports obtaining frames in video mode(so lower res...

Simulink: implementing a custom transfer function

Let's say I implement this m-file: Fq=tf(0.5^2,[1 2*0.7*0.5 0.5^2]); G=tf(0.006*[200 1],[80 1 0]); Q=Fq/G; open Inner_Loop.mdl Inside Inner_loop.mdl, if I want to implement/model a transfer function block using G, how can it be achieved easily? In other words, how can I retrieve the numerator and denominator of a tf easily? Thanks i...

Metric 3d reconstruction

I'm trying to reconstruct 3D points from 2D image correspondences. My camera is calibrated. The test images are of a checkered cube and correspondences are hand picked. Radial distortion is removed. After triangulation the construction seems to be wrong however. The X and Y values seem to be correct, but the Z values are about the same a...

Is there a function for checking whether a matrix is diagonally dominant (row dominance)

A matrix is diagonally dominant (by rows) if its value at the diagonal is greater then the sum of all absolute value in that row. Same goes for columns, only the other way around. Is there a function in matlab for chekcing this ? (I could write a simple loop, but I'm trying to quit those). ...

How to override the default text in MATLAB

In MATLAB, when you click File -> New -> Function M-File, you get a file with the following contents: function [ output_args ] = Untitled( input_args ) %UNTITLED Summary of this function goes here % Detailed explanation goes here end Is it possible to override this behaviour, and specify your own text? (The motivation is that I'm...

Typecast to an int in Octave/Matlab

I need to call the index of a matrix made using the linspace command, and based on somde data taken from an oscilloscope. Because of this, the data inputed is a double. However, I can't really call: Time[V0Found] where V0Found is something like 5.2 however, taking index 5 is close enough, so I need to drop the decimal. I used this ...

Getting average value from matlab plot?

Hey, I have a simple plot which feature a lot of data points, when i have have graph. Is there a way that i can simple click on all these point and allow matlab to give me a average value of them? Thank you ...

filter that uses elements from two arrays at the same time

Let's assume we have two arrays of the same size - A and B. Now, we need a filter that, for a given mask size, selects elements from A, but removes the central element of the mask, and inserts there corresponding element from B. So the 3x3 "pseudo mask" will look similar to this: A A A A B A A A A Doing something like this for aver...