Answered
create a specific matrix data ?
The desired result is trivially obtained with <https://www.mathworks.com/help/matlab/ref/repelem.html |repelem|>: N=[2;3;4;...

9 years ago | 0

| accepted

Answered
divide RGB color space into 16x16x16 bins
Assuming your image is of type double (i.e: intensity range is 0-1), then: bins = linspace(0, 1, 16); %if image is uint8, ...

9 years ago | 0

| accepted

Answered
how to project image into (x,y) coordinates graph
If I understood correctly you have a binary image and you want the pixel count (which you call the pixel number) along each colu...

9 years ago | 0

Answered
Problem with reading text file and making changes
If I understood correctly: filecontent = fileread('C:\somewhere\somefile.txt'); %replace path as appropriate filecontent...

9 years ago | 0

Answered
I'm executing image scrambling code but im getting index exceeds matrix dimension error.
There are several issues with your code. out = zeros() creates an |out| matrix of size 1x1. Although it's not so critica...

9 years ago | 0

Answered
Convert a vector to a binary matrix
Use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|> to transform row/column coordinates in linear indices and...

9 years ago | 3

| accepted

Answered
How can I create a double array in a C++ mex file from a matlab vector input?
Whatever the signature of your function i.e. one of: double* functionwithinmexfile(double* in); //or double* function...

9 years ago | 1

Answered
Search for an array in a matrix to store indices of the matrix where its located.
I'm not entirely sure what it is you're asking. From your example, it looks like you want to know which rows of |B| have an elem...

9 years ago | 0

| accepted

Answered
creating a matrix where the element of the second column is smaller than the element of the first column
In terms of clarity and speed, a loop is probably the best, I'd implement it as: n = 4; %largest number result = zeros(n...

9 years ago | 0

| accepted

Answered
Calling a function option using cellfun
You need to create a new function that only takes one input argument (the cell array element) and then call |datestr| with that ...

9 years ago | 2

| accepted

Answered
How can I speed up my code to divide cell array
I would actually recommend that you don't split your tables into smaller tables. The best answer is probably to advise you to me...

9 years ago | 0

Answered
Cellfun not working for cells contain cells?
Your |cellfun| code simply says: negate the content of each cell in the outer cell array. However, that content is itself a cell...

9 years ago | 2

| accepted

Answered
Why do I get this function warning (Function behaves unexpectedly on array inputs)
|fplot| is trying to call your function with a vector input, e.g. camdisp(0:360) Your function errors in that case, henc...

9 years ago | 2

Answered
ind2gray problem
_Do you know if there is another way for me to create a grayscale picture ?_ This can be achieved any number of ways. An easy...

9 years ago | 0

Answered
How to modify a specific line in a text file
There are many ways you could do this, depending on specifics of the file. For example, if it's always the same line number, you...

9 years ago | 2

| accepted

Answered
Is there any alternative way for multiple if else statement ?
Firstly, _"variable names q1,q2,q3,q4,q5"_ As soon as you start creating numbered variables (or any sequentially named var...

9 years ago | 1

Answered
Loading C++ shared library DLL into matlab
Solely from looking at this: warning: null character(s) ignored / / S D K D l l . h : S D K D l l D L L m a i n ...

9 years ago | 1

Answered
Put array data inside another array without a for cycle
Very simply: array2(array1 == 0) = 0

9 years ago | 1

| accepted

Answered
How to erase this?
Matlab display |ans = ...| when you call a function that returns an output and don't assign that output to a variable. e.g. if y...

9 years ago | 0

Answered
Is it possible to create an inline function which gives back n binary digits of a number in a vector?
You can either use V = dec2bin(x, N) - '0' as per Walter's answer or V = bitget(x, N:-1:1) The advantage of the ...

9 years ago | 1

Answered
How do you check if all the values in a vector are in another vector as many or more times?
fullset = [1 1 3 4 4]; baseset = [3 3 4 7]; [basesetvalues, ~, subs] = unique(baseset); basesetcount = accumarra...

9 years ago | 0

| accepted

Answered
How do I find non-zero values + lonely zeros in an array?
v = [0 1 2 2 2 0 0 4 5 0 3 0 0 0 5]; union(strfind([false, v == 0, false], [0 1 0]), find(v))

9 years ago | 0

| accepted

Answered
Fill empty matrix with determined values
There are some very odd constructs in the code you've written: desired_range = squeeze(...) ... = desired_range(:) ...

9 years ago | 0

| accepted

Answered
why pop up the error using *
As it is, your |i| loop is pointless as the only thing that depends on |i| is the row of |u| where you put the result. So, even ...

9 years ago | 0

Answered
How to circular shift a matrix for every 1 to 6 elements until its end?
If I understood correctly, all you have to do is reshape your original array into rows or columns of 6 elements, perform the cir...

9 years ago | 1

Answered
Problem with textscan when file doesn't exist.
It would be interesting to know under which circumstances your code generates the error. The code does not make much sense, but ...

9 years ago | 1

Answered
Understanding Cell Array Indices
Sounds like you just picked code from somewhere without understanding what it does at all. All that code does is tell you the in...

9 years ago | 0

| accepted

Answered
How to solve Unexpected MATLAB expression for user input
You'll get all sort of weird error messages, including |Unexpected MATLAB expression| if the user enters anything at your prompt...

9 years ago | 0

Answered
How to split a matrix in "submatrices"?
As others have said, there may be no need to explicitly split the matrix, but if you must what is wrong with: newdata = mat...

9 years ago | 0

| accepted

Answered
How to get the second lowest value in the vector
I'm not sure I've understood what you want. If you want the 2nd lowest value greater than -1: In <R2017b: realvalues = r...

9 years ago | 0

Load more