Answered
NxN matrix with 2s on main diagonal
N = 8; %e.g. m = full(gallery('tridiag', N)); m([N, (N-1)*N+1]) = -1

10 years ago | 0

| accepted

Answered
Calculate the distance between a point and all the others
See comment to question. You need to learn matlab first. In R2016b, this is very straightforward: points = [-20, 90; ...

10 years ago | 0

| accepted

Answered
How to creat a four dimentional (from a vector) matrix and reset it's 'lower triangle'
I've not tried to understand exactly what you're doing but this produces the right result: A = [1 2]; k1 = kron(A.', A);...

10 years ago | 0

Answered
is copied data integrity assured after success = copyfile(source,target) and success = 1?
It just means that the OS did not report an error, nothing more. The only guarantee you have is that, to the best of knowledge o...

10 years ago | 0

Answered
Can anyone please explain the lsb embedding part of this coding? I'm unable to comprehend how it works. .
In a very convoluted way, this set the least significant bit of the pixels of the image to the corresponding bit of the message ...

10 years ago | 0

| accepted

Answered
Filtering one array in a 1x4 cell
I assume by 1st and 2nd _array_, you actually mean column. One possibility: filtered_psn = cellfun(@(m) [m(:, 1), yourfi...

10 years ago | 0

Answered
Using bsxfun instead of arrayfun for repeating function
|bsxfun| serves a completely different purpose to |arrayfun|. One rarely replaces the other. Note that as of R2016b, <https://ww...

10 years ago | 2

| accepted

Answered
Writing the column vectors of matrix X into individually specified columns of matrix Y
Option 1: Use a loop. It probably is the fastest for xcol = 1 : numel(idx) Y(:, idx{xcol}) = X(:, xcol); end Opt...

10 years ago | 0

Answered
Merging specific rows from multiple text files.
I don't see where the difficulty is in modifying your code to skip the writing of the first 30 lines of each file: %....

10 years ago | 0

| accepted

Answered
How to find the median of nonzero elements in each row of sparse matrix
Note: I have no experience with sparse matrices. Saying that, just looking at the beginning of your code, it's trivial to go ...

10 years ago | 1

| accepted

Answered
is there a function in matlab R2014a similar to 'quarter'?
Aah! it's a |datetime| method. Hence why matlab returns undefined function when I typed |quarter| at the command line. I should ...

10 years ago | 1

Answered
Matrix dimensions must agree
There are a few things that are confusing in your code: lwest = ... ...; clear all So you wipe out all the variables ...

10 years ago | 0

Answered
Can MATLAB create subfolders within subfolders, programmatically?
Actually, do not use |cd| at all. It's a complete waste of time and may cause code to fail since it affects where matlab looks f...

10 years ago | 3

| accepted

Answered
Find center of mass of parts of a matrix
Well, go back to the definition of the centre of mass, which is just a weighted mean: %inputs: %originalmatrix: the orig...

10 years ago | 0

| accepted

Answered
How to delete a row of a table in a loop while indices are changing
From your comments, I'm going go out on a limb and assume that your (very badly named) table variable is actually not a <https:/...

10 years ago | 2

Answered
readtable modify numbers when i am importing from .txt
Question 1: You are confusing what matlab is showing you versus what is actually stored by matlab. For convenience, matlab roun...

10 years ago | 0

| accepted

Answered
Lost seconds when converting a datetime object with datenum/datestr
Same as dpb, I don't see this behaviour. In R2016b, >> a = datetime(2016, 7, 1, 8, [57;58;59], 50, 'Format', 'dd.MM.yyyy hh...

10 years ago | 0

Answered
how to make table of ip address numbers
If using R2016b, you can use the new <https://www.mathworks.com/help/matlab/matlab_prog/create-string-arrays.html string type>. ...

10 years ago | 0

| accepted

Answered
uniform distribution between a and b with intervals of 0,005
How about generating uniform integers between 0 and 0.2/0.005 and multiplying the whole lot by 0.005 R = randi([0 0.2/0.005...

10 years ago | 0

| accepted

Answered
Please help: Cell contents assignment to a non-cell array object.
I don't understand the purpose of the extremely badly named |a|, |b|, ... |f|. Use meaningful variable names. In any case, th...

10 years ago | 0

Answered
row location info from matrix
This is simply combining comparisons: row = find(yourmatrix(:, 2) > 0.53 & yourmatrix(:, 2) < 0.54 & ... your...

10 years ago | 0

Answered
I have to make a code that does matrix multiplication. This is what I have so far but I'm not sure why it's not working. I cannot figure out if my for loops for k, i, and j are correct.
I suggest you go back to the definition of matrix multiplication. This involves a sum which appears nowhere in your code.

10 years ago | 0

| accepted

Answered
How to compare matrix elements with their neighbors?
That's extremely easy using simple indexing or, if you want to be a bit more fancy, using <https://www.mathworks.com/helpmatlab/...

10 years ago | 0

Answered
How to read data in excel file and make if statement to build another column
What you should do is not use an |if| statement and rather use the proper functions. It's not exactly clear what the final aim. ...

10 years ago | 0

Answered
extracting matrix row whose element which satisfy equation of a cirlce
What's the difficulty? %points: nx2 matrix of points %centre: 1x2 vector of circle centre %radius: radius of circle ...

10 years ago | 0

| accepted

Answered
Class association has error
Well, learn to read error messages. It's telling you that the superclass |handel| cannot be found. That's because you misspelled...

10 years ago | 2

Answered
Find maximum values and their range and remove them to find the next maximum values
I don't really understand the question. Your code does replace the maximum value by -Inf at each step of the loop, which seems t...

10 years ago | 0

Answered
Extracting all elements from a vector without knowing the length
That is a fairly common operation in matlab. Use the expansion of cell arrays into <https://www.mathworks.com/help/matlab/matlab...

10 years ago | 1

Answered
Need help finding mistakes in code
If just by reading the code, you can't see what is wrong with it, I suggest you use the <https://www.mathworks.com/help/matlab/m...

10 years ago | 0

Answered
skip parameters in function
The function passed to any of the |ode| functions must have a specific signature (number of inputs and outputs), since |odexxx| ...

10 years ago | 0

Load more