matlab

How can I create an acronym from a string in MATLAB?

Is there an easy way to create an acronym from a string in MATLAB? For example: 'Superior Temporal Gyrus' => 'STG' ...

How can I calculate the historical volatility of a stock in MATLAB?

I would like to create some simulated historical options data, and need to calculate historical volatility from historical stock prices. Is there a built in function to do this? Any formulas? ...

Matlab vs. Java

How is MatLab slower than Java? Are there any ways in which it is faster? ...

How to convert a C++ program that uses CUDA into MEX

For work, I am converting the Image Denoising program that comes with the CUDA SDK into a MATLAB program. As far as I know, I have made all the necessary changes required by MATLAB, but when I try to call mex on it, MATLAB returns a bunch of linkage errors that I have no idea how to fix. If anyone has any suggestions on what I might be d...

Feature Selection methods in MATLAB?

Hi, I am trying to do some text classification with SVMs in MATLAB and really would to know if MATLAB has any methods for feature selection(Chi Sq.,MI,....), For the reason that I wan to try various methods and keeping the best method, I don't have time to implement all of them. That's why I am looking for such methods in MATLAB.Does any...

How can I make this text file into a list in MATLAB?

I have a text file and would like to import it into MATLAB and make it a list: Person1 name = steven grade = 11 age= 17 Person2 name = mike grade = 9 age= 15 Person3 name = taylor grade = 11 age= 17 There are a few hundred entries like these above. Each are separated by a blank line. I was thinking I could scan the text and make the...

Problems with real-valued input deep belief networks (of RBMs)

I am trying to recreate the results reported in Reducing the dimensionality of data with neural networks of autoencoding the olivetti face dataset with an adapted version of the MNIST digits matlab code, but am having some difficulty. It seems that no matter how much tweaking I do on the number of epochs, rates, or momentum the stacked R...

How to tell MATLAB to open and save specific files in the same directory

I have to run an image processing algorithm on numerous images in a directory. An image is saved as name_typeX.tif, so there are X different type of images for a given name. The image processing algorithm takes an input image and outputs an image result. I need to save this result as name_typeX_number.tif, where 'number' is also an o...

Inversion of an image

How do you invert an image (reversing grayscale) in MATLAB? ...

steganography in matlab

Hi I'm working on steganography in binary image.but I have a problem in implementation in matlab. I want to konw that, How can I hide a message in a binary image? And, How can I do it in matlab with m-file or simulation? ...

MATLAB how to write header in text file

How to write a text header in text file? for example in the example below, how to write the header code salay month just once? Code Salary Month 12 1000 12 14 1020 11 11 1212 9 fid = fopen('analysis1.txt','wt'); for i=1:10 array = []; % empty the array .... array = [code salary month]; format short g; fprin...

How can I accumulate cells of different lengths into a matrix in MATLAB?

So, I have a cell-array of 1xN vectors of different lengths. I want to append them into a matrix so I can display them with imagesc. Obviously the matrix must be the width of the largest vector. My current code for this is below: tcell = {[1,2,3], [1,2,3,4,5], [1,2,3,4,5,6], [1], []}; lens = cellfun('length', tcell); rmat = NaN(length(...

problems parsing textfile in Matlab, is there a way to allow fields to have multiple lines?

I have a textfile that I am I want to make into a list. I have asked two questions recently about this topic. The problem I keep coming across is that the I want to parse the textfile but the sections are of different length. So I cannot use textscan(fid,'%s %s %s') because the length of each gene varies. I have also had trouble using...

Is there a way to recognize blank lines in Matlab?

Id there a way to recognize blank lines when you are scanning a textfile in Matlab? I want to parse the files based on the blank lines in between the text. Is this possible? ...

How to format output using MATLAB's num2str

I'm trying to ouput an array of numbers as a string in MATLAB. I know this is easily done using num2str, but I wanted commas followed by a space to separate the numbers, not tabs. The array elements will at most have resolution to the tenths place, but most of them will be integers. Is there a way to format output so that unnecessary tra...

texture analysis statistic, feature extraction for detection object in matlab

i have a project that can detect a object from picture.it used backpropagation scale conjugate gradient for training. i used 10 component for input. r,g,b, standard deviation, entropy, threshold( Onsu method), glcm that contains contrast, homogeneity,correlation and energy. i manually extract them. i have 100 input. 50 are object, 50 are...

Can you treat a string as one object in a list in MATLAB?

I would like to make a list of strings in MATLAB using the example below: x = ['fun', 'today', 'sunny'] I want to be able to call x(1) and have it return 'fun', but instead I keep getting 'f'. Also, is there a way to add a string to a list without getting the list giving back a number where the string should be? I have tried using st...

How can I remove duplicates in an array but keep the same order?

I have this cell array in MATLAB: y = { 'd' 'f' 'a' 'g' 'g' 'a' 'w' 'h'} I use unique(y) to get rid of the duplicates but it rearranges the strings in alphabetical order: >> unique(y) ans = 'a' 'd' 'f' 'g' 'h' 'w' I want to remove the duplicates but keep the same order. I know I could write a function do do this bu...

How to generate random numbers of lognormal distribution within specific range in Matlab

My grain sizes are defined as D=[1.19,1.00,0.84,0.71,0.59,0.50,0.42]. The problem is described below in steps. Grain sizes should follow lognormal distribution. The mean of the grain sizes is fixed as 0.84 and the standard deviation should be as low as possible but not zero. 90% of the grains (by weight %) fall in the size range of 1....

Example of 10-fold SVM classification in MATLAB

Hi, I need a somehow descriptive example showing how to do a 10-fold SVM classification on a two class set of data. there is just one example in the MATLAB documentation but it is not with 10-fold. Can someone help me? ...