Answered
Count another directory subfolder
You don't assign the output of the first line to anything, so it's a wasted lines. The second line just call |dir| again but sin...

10 years ago | 0

| accepted

Answered
Legend for variable number of plots
legend(arrayfun(@(mode) sprintf('Mode %d', mode), 1:size(y, 2), 'UniformOutput', false)) Would be one way of doing it.

10 years ago | 0

| accepted

Answered
creatinng a 3D matrix
It looks like at least one of your image is not the same size as the other. For now, load the images in a cell array: imgs ...

10 years ago | 0

| accepted

Answered
How to write an empty matrix with 4 number of rows and 3 columns. How to write an epmty row vector.
The definition of an empty matrix is that one of the dimension has size 0. Therefore, by definition a matrix of size 3x4 is *not...

10 years ago | 0

Answered
how to plot binary input
bitstrings = [0 0 1 1 0 0 0; 0 1 0 1 0 0 1; 1 0 1 1 1 0 0; 0 1 0 1 0 0 0;] ...

10 years ago | 0

| accepted

Answered
Is it possible to use 'numel' in nested struct?
No, the error has nothing to do with numel. As the error says, you're attempting to access a field (b maybe) of something that i...

10 years ago | 0

| accepted

Answered
Convert indexed image to rgb and back without losing data
One of the issue is that you're using <http://www.mathworks.com/help/matlab/ref/rgb2ind.html |rgb2ind|> with the default option,...

10 years ago | 1

| accepted

Answered
Creating average of y-values for similar x-values in dataset
I think you need to spend more time learning matlab as your attempt does not even qualify as a half attempt. There's a complete ...

10 years ago | 0

Answered
Checking Previous Value in an Array.
* Step 1: build a matrix with 6 rows, where each row is your vector shifted one value to the left. Use a loop for that, or <http...

10 years ago | 0

| accepted

Answered
How to plot distribution curves of two vectors ?
Use <http://www.mathworks.com/help/matlab/ref/discretize.html |discretize|> to build your bins and <http://www.mathworks.com/hel...

10 years ago | 0

| accepted

Answered
Problems with strrep: y(1)0 instead of y(10)
First, learn to use <http://www.mathworks.com/help/releases/matlab_prog/debugging-process-and-features.html matlab's debugger>. ...

10 years ago | 0

Answered
How to get handle of corrplot?
Since |corrplot| does not return any figure handle you'll have to acquire it with |gcf|. Make sure that the correct figure is se...

10 years ago | 1

| accepted

Answered
Opposite to horzcat?
Note that if what you want to do is just separate a filename into its different components, you can use <http://www.mathworks.co...

10 years ago | 1

Answered
How can I extract multiple values after certain term with regexp?
There are many ways to write a regular expression (see Walter's answer), depending on exactly what restriction you want to place...

10 years ago | 1

| accepted

Answered
movefile and copyfile give no result, why?
I have no idea why |copyfile| would fail to copy a file and still return a success status. In the code you've posted, you don't ...

10 years ago | 1

Answered
How to define struct for building a mex function
Initialise the structure with empty fields of the correct type. In your case, since the type of the fields is double, simply ini...

10 years ago | 0

Solved


Find the gcm of n given values
Create a function that given n integer values greater than zero, finds the two numbers with the greatest common divisor and retu...

10 years ago

Answered
Counting program every positive element
This is the common problem of finding the run length of a sequence. There are plenty of answers for this on this forum. First...

10 years ago | 0

Answered
How Can we extract the green channel matrix alone from colour image? Is there any formula apart from matlab extraction
greenchannel = rgbimage(:, :, 2); The first page of an rgb image is the red channel, the 2nd is the green channel and the 3...

10 years ago | 1

Answered
How do I sum many vectors together by using 'for' loop?
* There is nothing 3D in your example. Your |pos_swarm| is 2d. * *DO NOT* use sum as a variable name, it prevents you from usin...

10 years ago | 0

| accepted

Answered
How can I convert the 8*8 matrix a to 4*4 matrix b using downsample
The two answers you've got are downsampling, using nearest neighbour interpolation. More advanced ways of downsampling your m...

10 years ago | 1

Answered
how to rotate image by using pixel by pixel?
Why aren't you using <http://www.mathworks.com/help/images/ref/imrotate.html |imrotate|>? a = imrotate(x, 45, 'nearest', 'l...

10 years ago | 0

Answered
Create a movie from images
I don't think that the call to |im2frame| is necessary. You can directly write the image returned by imread to the video. (I've ...

10 years ago | 1

Answered
How to save a matix as an image?
Matlab consider the type of the matrix to establish what intensity range corresponds to fully dark-fully white. If the matrix...

10 years ago | 2

Answered
Changing file name in matlab
If I understood correctly: %get list of files folder = 'c:\somewhere\on\a\filesystem\'; files = dir(fullfile(folder, ...

10 years ago | 0

Answered
Problem Related to Scenario Generation.
The following will work for input matrices of width of 10 or less, due to the usage of dec2base to generate the various column c...

10 years ago | 0

| accepted

Answered
Regexp: Take the expression with text only
So basically, for the name you want to match any character that is not a number, or underscore. You could also add that you do n...

11 years ago | 1

| accepted

Answered
Hi! I'm trying to extract the top N elements of each kind in a matrix
It's not clear what 'kind' refers to, it looks like it's the value of the second column. In which case, m = [10 1 ; 20 1; 1...

11 years ago | 0

| accepted

Answered
matlab too slow in creating one new variable, looking for more efficient way
z.Bucket = discretize(z.Price, [6.49, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 9.991, Inf]) Note that I made the last bin (9) starts at...

11 years ago | 0

| accepted

Answered
how to create bit vector depending on another bit vector ?
One possible way: bitpatterns = {[0 1], [1 0]}; %in the order pattern for 0, pattern for 1 TMP_reg = [0 0 1 0 1 1 0]; %l...

11 years ago | 1

| accepted

Load more