matlab

How to delete zero components in a vector in Matlab?

I have a vector for example a = [0 1 0 3] I want to turn a into b which equals b = [1 3] How do I perform this in general? So I have a vector with some zero components and I want to remove the zeroes and leave just the non-zero numbers. Sorry I am new to Matlab ...

How to recognize this simple capcha using MATLAB?

Is there a simple solution in MATLAB? ...

Daubechies-4 Transform in MATLAB

Hello: I have a 4x4 matrix which I wish to decompose into 4 frequency bands (LL, HL, LH, HH where L=low, H=high) by using a one-level Daubechies-4 wavelet transform. As a result of the transform, each band should contain 2x2 coefficients. How can I do this in MATLAB? I know that MATLAB has dbaux and dbwavf functions. However, I'm not su...

I need help on this data file to be edited in SOM_PAK format

Hi Experts, I am working on Self Organizing Map (SOM) Implementation and i have a microarray dataset which i am trying to read in using some_read_data function, but i keep having an errors when i edit it to have it in SOM_PAK form which is recognise by SOM for reading such as ??? Error using ==> somtoolbox\som_read_data.m Only 69 vector...

Calculate area under FFT graph in MATLAB

Currently I did a FFT of a set of data which gives me a plot with frequency at x axis and amplitude at y axis. I would like to calculate the area under the graph to give me the energy. I am not sure how to determinate the area because I am without the equation and also I only want a certain area of the plot rather than whole area under...

How to do median filter on an indexed image using MATLAB?

medfilt2(img) doesn't take a map as parameter, so I don't think it can work well with indexed image, how do I impelemnt an median filter that can be used to process indexed images? ...

Is there any difference between [1 2] and [1 ,2] in MATLAB?

>> [1 2] ans = 1 2 >> [1 ,2] ans = 1 2 >> It looks the same,is that true? ...

best way to get a vector from sparse matrix

Hi, I have a m x n matrix where each row consists of zeros and same values for each row. an example would be: M = [-0.6 1.8 -2.3 0 0 0; 0 0 0 3.4 -3.8 -4.3; -0.6 0 0 3.4 0 0] In this example the first column consists of 0s and -0.6, second 0 and 1.8, third -2.3 and so on. In such case I would like to reduce m to 1 (get a vector fro...

matplotlib equivalent for MATLABs truesize()

I am new to matplotlib and python and would like to display an image so that 1 pixel of the image is actually represented by 1 pixel in the figure. In MATLAB, this is achieved with the command truesize(). How can I do this in Python? I tried playing around with the imshow() arguments as well as set_dpi() and set_figwidth()/set_figheight...

How to select which Matlab version to start from shell or Matlab startup?

I have multiple Matlab versions installed on my PC. To say, R2006b, R2009b, R2010a. In this particular application I want to start R2009b when I start it from Shell. Is there any options at the time of startup to select which version to run? ...

Retrieve blob field from mySQL database with MATLAB

I'm accessing public mySQL database using JDBC and mySQL java connector. exonCount is int(10), exonStarts and exonEnds are longblob fields. javaaddpath('mysql-connector-java-5.1.12-bin.jar') host = 'genome-mysql.cse.ucsc.edu'; user = 'genome'; password = ''; dbName = 'hg18'; jdbcString = sprintf('jdbc:mysql://%s/%s', host, dbName); jdb...

SVM Visualization in MATLAB

How do I visualize the SVM classification once I perform SVM training in Matlab? ...

MATLAB: draw centroids

Hello - my main question is given a feature centroid, how can I draw it in MATLAB? In more detail, I have an NxNx3 image (an rgb image) of which I take 4x4 blocks and compute a 6-dimensional feature vector for each block. I store these feature vectors in an Mx6 matrix on which I run kmeans function and obtain the centroids in a kx6 matr...

Naming convention of im2bw in MATLAB

What does w mean in im2bw ? ...

What does fopen('text.txt', 'wt') mean in MATLAB?

I tried help fopen, but there is no explanation what t means . ...

Why is sum(X, 1) the sum of the columns in MATLAB?

>> X = [0 1 2 3 4 5] >> sum(X, 1) ans = 3 5 7 sum(X, 1) should sum along the 1st dimension(row) as per the document says: S = SUM(X,DIM) sums along the dimension DIM. But why does it actually sums along the 2nd dimension(column)? ...

What does L == 2 mean in MATLAB?

BW = logical([1 1 1 0 0 0 0 0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 0 0 0 0]); L = bwlabel(BW,4); [r,c] = find(L == 2); How can a mat...

How to get all files under a specific directory in MATLAB?

I need to get all those files under D:\dic and loop over them to further process individually. Does MATLAB support this kind of operations? It can be done in other scripts like PHP,Python... ...

How to find the shortest path between two blobs(contours/closed curves) using MATLAB?

bwlabel can be used to get disconnected objects in an image: [L Ne] = bwlabel(image); How to calculate the shortest path between two disconnected closed curves? Is there a practical(not theoretical) solution? ...

What's the difference between {} and [] in MATLAB?

>> A={1 2;2 3} A = [1] [2] [2] [3] >> A=[1 2;2 3] A = 1 2 2 3 It seems to me they are essentially the same thing? ...