Answered
Calculating daily Average if only, the value is not zero
If you already have an algorithm that compute the mean, the simplest thing would be to replace the 0 with NaN and add the |'omit...

10 years ago | 1

| accepted

Answered
Assign value to field of nested structure in a structure array
That's one of the downside of multilevel structures. As Jan says, it's not possible to assign at once to fields of a substructur...

10 years ago | 2

| accepted

Answered
how can i convert RGB image to indexed image without using toolbox?
Since <https://www.mathworks.com/help/matlab/ref/rgb2ind.html |rgb2ind|> is part of base matlab, you can use that. No toolbox re...

10 years ago | 0

Answered
Neighbors of a pixel
Well, you can certainly use a convolution for the central part. I would just use smaller convolution kernels for the edges so: ...

10 years ago | 1

Answered
How can I sort my data from regexp?
There is no real need for the intermediate regexp, you can get it all with just one regular expression: tokens = regexp(TXT...

10 years ago | 0

| accepted

Answered
help needed in map reduce code.
If your input is in UTC and you want the datetime objects to display time in your local timezone, you first need to construct th...

10 years ago | 0

Answered
Plotting just x = 1 over an x and y graph
a = 2; x = 1:linspace(1, 100, 10); y = 1:numel(x); plot(x, [zeros(size(x)); (a-y).*(1+y)./y; repmat(1/(a-1), 1, num...

10 years ago | 0

Answered
Anyone know how to create a multidimensional subclass constructor?
That's a very interesting question and I think it shows another problem with matlab class design. The problem you'll encounte...

10 years ago | 1

| accepted

Answered
using fprintf instead of dlmwrite to make a .txt file
Well, if all you want to do is ensure that the line endings of your files is consistently CR /LF, then the simplest thing is to ...

10 years ago | 0

| accepted

Answered
Finding Values of a nxn Matrix and Displaying Values
unique(M) is what you want.

10 years ago | 0

| accepted

Answered
I am triying to rearranging the matrix and form one as explained below
Following on from Alexandra Harkai's comment to your question: A = [1 2;2 16;3 5;1 12;2 6;3 7;1 5;2 7;3 6;1 7;2 10;3 18] ...

10 years ago | 0

Answered
Why the matrix is changing from 10X10 to 1X100
If you want to replace the elements of |fm_layer| one by one in some random order then: fm_layer = ones(nrows); for idx ...

10 years ago | 0

Answered
Where is my mistake in loop?
Not even trying to understand what your code is doing, the problem is obvious while some condition do something that ...

10 years ago | 0

Answered
how to convert a numeric variable into categorical variable in matlab
The first line of the documentation of <https://www.mathworks.com/help/matlab/ref/categorical.html |categorical|> says: _"To gro...

10 years ago | 1

Answered
sort X and Y columns according to a repeated string in a 3rd column and scatter plot
This should work (see <https://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonscalar-struct-array.ht...

10 years ago | 3

| accepted

Answered
How can we plot a 256-bit array at a particular value on x-axis?
I'm not completely sure I understand. Maybe this is what you want: bitarray = randi([0 1], 10, 256); %random array of 10 2...

10 years ago | 0

| accepted

Answered
Constructing a a family of anonymous functions by recursion.
Be careful that matlab is case sensitive, you have |Recursivefun| and |RecursiveFun|. Your code works. Yes, matlab has not re...

10 years ago | 1

| accepted

Answered
How can i make a function with a input parameter?
All you need to convert your script into a function is: * delete the |clear all| and |clc|. These have no place in a function...

10 years ago | 0

| accepted

Answered
How to save data in multiple sheets with xlswrite?
If I understood correctly: %input: %A: cell array of char arrays. wants to find the year in there. % the year (alwa...

10 years ago | 0

| accepted

Answered
how to get n by n matrix from a given matrix?
If you have the image processing toolbox, you could use <https://www.mathworks.com/help//images/ref/nlfilter.html |nlfilter|> fo...

10 years ago | 0

| accepted

Answered
Why does this code give an answer for each column seperately?
By default, |sum| sums all the elements of each column together. You can change whether it sums by column, row, or other dimensi...

10 years ago | 2

| accepted

Answered
RGB layers separation for RAW or TIF image
The <https://www.mathworks.com/helpimages/ref/demosaic.html |demosaic|> function is what you need to convert you Bayer pattern i...

10 years ago | 0

Answered
Apply mean and standard deviation of an image to another image
Really, this can be done with just one operation, with much less error accumulation and chance of truncation (if integer images)...

10 years ago | 0

| accepted

Answered
How to remove corrupted data lines from text file
Here's I would approach your problem: filecontent = fileread('C:\path\to\yourfile.txt'); %read all file at once filelin...

10 years ago | 0

Answered
Coding a program to write an M file - possible?
You can of course write any type of file you want with matlab <https://www.mathworks.com/help/matlab/low-level-file-i-o.html low...

10 years ago | 0

Answered
How to store all FOR loop iteration in a vector and plot every iteration?
The loop is not needed at all, |filter| can operate on the column of whole matrices at once. However, since you're working on ro...

10 years ago | 1

| accepted

Answered
Reducing the computation time using a for loop
You do not need a loop at all if you use <https://www.mathworks.com/help/matlab/ref/ismember.html |ismember|>: [isinB, Brow...

10 years ago | 0

| accepted

Answered
Using sprintf to get variables from a file
[x, y] = ndgrid(1:4, 1:4); %first 1:4 is x range, 2nd 1:4 is y range names_f = arrayfun(@(xx, yy) sprintf('FORCE_%d_%d', xx...

10 years ago | 0

| accepted

Answered
Basic Question: How to index into table by a text column
To return all rows of a table whose column |somecolumnname| matches a specific string: filteredtable = yourtablename(strcmp...

10 years ago | 0

Answered
I need a reference or a method for looking up syntax details for COM methods. Is there such a reference or a Matlab command that would serve?
Assuming you're talking about the <https://msdn.microsoft.com/en-us/library/office/ff195734.aspx |GetSaveAsFilename|> method of ...

10 years ago | 1

Load more