Answered
How do i calculate a matrix of functions run for a number of values and save the matrix for each value
The simplest way is to keep your |X| definition as is and simply change your |n| so that the angles are arranged in the third di...

10 years ago | 0

Answered
Create a incremented 2D matrix
A simpler expression for your 1D case would be: toothCount(tempVec == 1) = toothCount(tempVec == 1) + 1; Assuming, that ...

10 years ago | 0

Answered
P{1}{1}....{1} suppose it has N {1}, how to express it with a variable N
Indexing in matlab is just a call to <http://www.mathworks.com/help/matlab/ref/subsref.html |subsref|>, so you can just call |su...

10 years ago | 1

Answered
Plot data from a cell array in a struct
I would recommend you use a <http://www.mathworks.com/help/matlab/matlab_prog/create-a-table.html table> instead of a cell array...

10 years ago | 0

| accepted

Answered
Get properties of histogram in MATLAB r2012a
Matlab replaced |hist| with |histogram| in newer versions of matlab partly because of this silly behaviour. You *have* to use...

10 years ago | 1

Answered
When i run my code contains function which i built, i get this error(look below)! So, i want to know what's means?And how can i solve it?Thanks in advance.
99% of the time when you get an error of the type |'undefined function xxxx'|, it's because matlab can't find the function, eith...

10 years ago | 0

Answered
How can I repeat same value of a variable for all month?
Use <http://www.mathworks.com/help/matlab/ref/eomday.html |eomday|> to work out how many days there are in a given month. Divide...

10 years ago | 1

Answered
finding data in multiple rows and column of excel
I would use <http://www.mathworks.com/help/releases/R2016a/matlab/ref/ismember.html |ismember|> to find the matching row, and si...

10 years ago | 0

| accepted

Answered
Function changing the display?
It's still not very clear what you want to do since the built-in |factorial| function that you're calling will carry out the che...

10 years ago | 0

Answered
how can I extract special contents of a text?
regexp(yourstring, '(?<=\()[^)]+', 'match') should do it. It matches any sequence of anything but closing brackets preceded...

10 years ago | 1

| accepted

Answered
export numeric array to ASCII file using save
Of course, there's a way to do it. Computers are particularly good at repeating the same task over and over. It's not clear ...

10 years ago | 0

| accepted

Answered
using the blockproc I want to move the block, but in an overlapping manner, now it has no overlap? my block size is [5 5]
Use <http://www.mathworks.com/help/images/ref/nlfilter.html |nlfilter|> instead of |blockproc|: fun = @(block) std2(block)/...

10 years ago | 0

Answered
problem with importing data from matlab to text file
From your description, it looks like the problem is with the way you view the text file, not with the way it saved. What program...

10 years ago | 0

| accepted

Answered
Convert 2-D array to multidimensional array
Using |accumarray|, you would have to duplicate your columns 1 to 5, once with 1 appended, then with 2 appended, to create the d...

10 years ago | 1

| accepted

Answered
How can I find multiple strings in a cell array?
First, your first solution is unnecessarily complicated. You're basically using a loop ( |cellfun|) to compare each individual s...

10 years ago | 10

Answered
Can anyone explain how can this happen?
If you put a breakpoint on the sin line and execute it from the debugger the error does not occur, so I suspect it's a 'bug' wit...

10 years ago | 0

Answered
Finding nearest low match in array
A simple way would be to set any value below 0 in your |tmp| to Inf, before calling |min|: f = [1 1.5 2.5 3 2 4.5 5.5 5]; ...

10 years ago | 0

Solved


MATLAB Prison: Summing light bulbs
On one wall in the MATLAB prison there is a row of n numbered light bulbs. Each bulb is controlled by a switch. Every morning, n...

10 years ago

Solved


Number of divisors of a given number
Given a Number n, return the number of his divisors without listing them example: n=14 ; Divisors={1,7,2,14} ; y=4 n=...

10 years ago

Answered
Avoid for loop which has an if-statement in it
Well, |str| can't be independent of the loop otherwise your code just repeat the exact same thing m x n times. Assuming |str|...

10 years ago | 1

Answered
Selecting values from an array when the array changes?
How about: link = [x(1:end-1); x(2:end)]' and iterate over the rows. Or if you really want to have individual arrays in ...

10 years ago | 0

Solved


Full combinations
Given n input vectors x1, x2, …, xn, generate a p*n matrix y whose rows contain all element-wise combinations of the vectors x1,...

10 years ago

Answered
How to remove duplicate nodes from generated path and segments inbetween?
Seems like you want to delete everything between the first and last occurrence of any identical digit: path = [1 6 7 2 1 6 ...

10 years ago | 0

| accepted

Answered
Preallocating for speed, what kind of variable is this?
As per dpb's answer, the loop and the if are completely unnecessary (and slow). Just use logical indexing on the whole array. As...

10 years ago | 0

Answered
How is this code binarizing an image?
The code divides the image into 30x30 square block (size is given by the badly named |Radius|). It calculates the mean intensity...

10 years ago | 2

| accepted

Answered
Best solution to cody problems
Assuming that you're talking about <https://www.mathworks.com/matlabcentral/cody/?s_tid=gn_mlc_cody that cody> and not <https://...

10 years ago | 0

| accepted

Answered
Search all strings occuring in structure
If I understood correctly this should do what you want: mothers = {A.Mother}; %concatenate all Mother fields into a cell ar...

10 years ago | 2

Solved


Accessing values in a cell
You are given c, which is a 1xN cell array, and a and b, which are each two 1xM vectors. Your job is to give the bth value in t...

10 years ago

Solved


How many ways to write a number
Given two positive numbers n and k, where n>=k. In how many ways can we write n as sum of k positive numbers. Same numbers but d...

10 years ago

Answered
Why does num2str not work for double digits
Your original problem is that you're trying to stuff strings of different lengths into a matrix. On the first round of the lo...

10 years ago | 1

Load more