Answered
How can I create a random matrix with specific percentage of numbers?
m = repelem([1 2 3], [57 20 23]); %create vector with 57 1s, 20 2s, 23s m = reshape(m(randperm(numel(m))), 10, 10) %shuffle ...

10 years ago | 0

Answered
Repeat rows in a matrix
B = repelem(A(1:22:end, :), 22, 1); is all that is needed. <https://www.mathworks.com/help/matlab/ref/repelem.html |repelem...

10 years ago | 14

Answered
How can I extract finite number of values below a threshold condition and all of the values above it?
Now that you've clarified what you want, this should work: rowstokeep = find(RunData1(:, 7) >= threshold); %get indices of...

10 years ago | 1

| accepted

Answered
Converting symbols in cell array to values of the postions of this symbols in other cell array
There is never any reason to use |find| with |ismember|. |ismember| already provides all the information you need with its first...

10 years ago | 0

| accepted

Answered
Switch statement using intervals.
This does not answer your question but may be helpful to others. The proper way of doing this in matlab would be: sizes = ...

10 years ago | 2

Answered
How do you change an n-by-2 array, where the 2 columns are datenum in 1 and associated value in 2, into a table where the rows are the years and the columns are months with the table populated by the associated values?
It may be possible to do this with the new <https://www.mathworks.com/help/matlab/ref/timetable.html |timetable|> type introduce...

10 years ago | 0

| accepted

Answered
Problem in plotting the matrix over an image.
|find| will return the locations of all the values above the threshold, there's no need for a loop img = imread('test.jpg')...

10 years ago | 0

Answered
Solving for a missing column
With only 8 values and 3 exponents, it's only 3^8 = 6561combinations to try, you could simply brute tests all at once: a = ...

10 years ago | 0

| accepted

Answered
How to find domain registrar name automatically via MATLAB
It looks like you want to run a whois query on each of these url. It's not something that is anywhere implemented in matlab. You...

10 years ago | 0

Answered
Sum every i-th row in matrix seperately
The problem with the code is simple, your for year =yearMin: yearMax was never meant to be a loop, you're already loopin...

10 years ago | 3

Answered
How to read 3 values in row of 3 columns as 1
Here is a *generic way* of creating all the combinations of all the rows of a (reasonable) arbitrary number of matrices. %i...

10 years ago | 1

| accepted

Answered
Error using table (line 253)
I assume that |Mode| is supposed to be the name of the columns, in which case the proper syntax should be: T = table(Radius...

10 years ago | 1

| accepted

Answered
Data Analysis: plot the min and max of a set of data
That is *not* a plot of min and max, this is a plot with error bars (typically based on standard deviation), which you can creat...

10 years ago | 0

| accepted

Answered
How can I create an array of class handles?
It all depends... * Assuming you don't have inheritance, then you can simply create a matrix of your class objects. You can c...

10 years ago | 3

| accepted

Answered
Error while using xlswrite for arrays
Even simpler, t = table(Random, MeanVA, MeanC, MeanP, MeanI, MeanU , 'VariableNames', ... {'RandomVariable', ...

10 years ago | 1

Answered
How do i calculate the gradient of a matrix that has non-constant step size??
|h1| and |h2| can also be the grid coordinates of |R|, so just pass these to the gradient function. If you only have the step si...

10 years ago | 0

| accepted

Answered
sparse function cannot get integer arrays for the indices
The documentation of <https://www.mathworks.com/help/matlab/ref/sparse.html |sparse|> does state that the only valid type for th...

10 years ago | 0

Answered
"Input grid is not a valid MESHGRID." matlab interp2
The problem is not your |ox| and |oy| (which don't even have to be gridded), but your |ix| and |iy| which need to be the vertice...

10 years ago | 2

Answered
if condition on cell array
The notation in your question is incomprehensible. Please use valid matlab syntax (and the *{} Code* button to format text as co...

10 years ago | 0

| accepted

Answered
how can i combine the binary values in a single cell of a uint8 matrix?
c = reshape(str2double(cellstr(dec2bin(a))), size(a)) is the closest to what you want. Note that it will be completely usel...

10 years ago | 0

Answered
How to run sorting on specific columns of a matrix, and make the remaining columns follow this newly sorted order
Wouldn't <https://www.mathworks.com/help/matlab/ref/sortrows.html |sortrows|> solve your problem?

10 years ago | 0

| accepted

Answered
Hi, I try to convert this matlab code to VB.NET or C# codes. Help me please..
Well, really, the best way for you to find out what it is doing is to go and ask whoever wrote that horror (and at the same time...

10 years ago | 1

| accepted

Answered
Complex Number Conversion to character form
What is _large scale data_? I don't see the problem in printing / converting complex numbers: n = pi + 1i*log(2); s =...

10 years ago | 0

Answered
changing time step of data or resample the data
If you're on R2016b, you could convert your matrix into a <https://www.mathworks.com/helpmatlab/matlab_prog/create-timetables.ht...

10 years ago | 0

Answered
how to write this for cycle
arrayfun(@(n) linspace(0, 1, n), 2.^(6:12), 'UniformOutput', false) will create 7 (not 6!) matrices with the exponent varyi...

10 years ago | 0

Answered
take sum log of probability matrix
This function will calculate the probability for a window: function lp = logprobability(window, p, r) uv = unique(win...

10 years ago | 0

Answered
Vectorize the code of a summation written with nested for loops
I'm assuming: * |a| is a column vector. If not, reshape it into a column vector with a = a(:); %or a = reshape(a, []...

10 years ago | 2

| accepted

Answered
How to populate a cell array?
Which of your points is not covered by the <https://www.mathworks.com/help/matlab/cell-arrays.html documentation>? There are ...

10 years ago | 0

| accepted

Answered
Why do I get Undefined function 'blkproc' in home edition
# The function is spelled <https://www.mathworks.com/help/images/ref/blockproc.html |blockproc|> # You need the imaging toolbo...

10 years ago | 0

Answered
i want to use nchoosek command in FOR loop in decreasing order for decoding process, it works in increasing order in FOR loop for encoding , Any suggestions
When you write |a:b|, matlab generates all numbers from |a| (included) to |b| (maybe included) in increments of +1. If |b| is sm...

10 years ago | 0

| accepted

Load more