Answered
How can I sort data in cells?
This solution can be reduced two lines but I added a third so it's easier to understand. Fake data are created at the top. % ...

7 years ago | 0

| accepted

Answered
Facing a problem in calculating the sum of digits of 100!.
This solution is fast and simple but only works for numbers <=21 (see notes below) so it's not the best approach. It computes...

7 years ago | 0

Answered
How to concatenate each row of a matrix into a vector ?
% create fake data A = [0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0...

7 years ago | 1

| accepted

Answered
Divide by Zero Warning
At some point matlab got rid of this warning so there's no way to turn it on with recent versions of Matlab. If you need this...

7 years ago | 0

| accepted

Answered
non overlapping random circles
The FEX contribution metioned by Matt J produces cirlces that are closely packed. I wrote an alternative function that plots ci...

7 years ago | 1

| accepted

Answered
How to insert a row in a matrix
Here's an example. data = rand(31,12); % your original matrix newRow = zeros(1,size(data,2)...

7 years ago | 4

| accepted

Answered
contour plot real numbers
The values of 'sigmaP1 ' are imaginary. You can identify this just by looking at those values. sigmaP1 (1:5) ans = Column...

7 years ago | 0

| accepted

Answered
Error using exist "The optional second input to exist must be 'var', 'builtin','class', 'dir' or 'file' "
It looks like you're checking the existance of a certain file named something like "A1.txt" on the matlab path prior to reading ...

7 years ago | 0

| accepted

Answered
Copy data from cell array to table
Here are some fake data that look similar to yours. A = {string(rand(18977,1)), rand(18977,1), rand(18977,1), rand(18977,1)}; ...

7 years ago | 3

| accepted

Answered
Match cell array of strings to table row names
First I create fake data (in the future, it would be helpful for you to provide this). Then we'll use ismember() to match the r...

7 years ago | 1

| accepted

Answered
Problem with defining size of a matrix
The error is coming from a function (or m-file) named "Q2". Perhaps the "myCGS()" function is stored in an m-file named "Q2"? ...

7 years ago | 0

| accepted

Answered
delete and handling matrix
To identify rows of a matrix where column 8 is less than 3 and column 6 is not zero, rowIdx = (matrix(:,8) < 3) & (matrix(:,6)...

7 years ago | 0

| accepted

Answered
Assigning new matrix values from another matrix's rows
If the converstion from [nx3] to [nx2] is arbitrary (ie, not calculable), here's how to create a lookup table and do the convers...

7 years ago | 1

Answered
how to solve this in matlab
This solution relies on only one for-loop (although technically you could replace this for-loop, too). 'sumOut' is the solution ...

7 years ago | 1

| accepted

Answered
Copying the content of a Figure to another Figure
The function copyobj(h,p) copies objects listed in h to a new parent, p. When your code is run, the error message indicates, "...

7 years ago | 6

| accepted

Answered
find peaks of a vector contains nan values
The code in your orginial question differs from the code you provided in the comments under your question. In your original code...

7 years ago | 0

| accepted

Answered
How to read data from a text file based on the title?
Instead of selectively reading a chosen subset of your text files (which I'm not even sure is possible), you can read in the ent...

7 years ago | 0

| accepted

Answered
Retrive cell names from structure into a string vector
See fieldnames() https://www.mathworks.com/help/matlab/ref/fieldnames.html

7 years ago | 0

| accepted

Answered
Self avoiding random walk help
Working from the cleaner version of your code I provided in the comments under your question, here's an adapted version that avo...

7 years ago | 1

| accepted

Answered
2D colour coded plot with already binned data
Here's an example of how to specify bins/edges using fake, random data. Using imagesc() https://www.mathworks.com/help/matlab...

7 years ago | 1

| accepted

Answered
Value to get back to initial
This solution finds the time window that starts and ends when dialysis is at 75 and 150, respectively. I created fake data to w...

7 years ago | 0

| accepted

Answered
Set up a function corresponding to this graph
In addition to the square() function (requires signal processing toolbox) and the heaviside() function (symbolic math toolbox), ...

7 years ago | 0

| accepted

Answered
Updating matrix with time
The solution depends on how the matrix is being updated but here's a general framework to updating a time varying matrix using i...

7 years ago | 1

| accepted

Answered
hypothetical matlab's limit
I'm sure there is such a limit in Matlab but it's nowhere near a vector length of 4884. The problem is that you have at least...

7 years ago | 2

Answered
Does any elegant way to pass augments through nested function calls
Instead of using vargin, you could include one input that is either a cell array or a structure. Example using cell array al...

7 years ago | 0

| accepted

Answered
How can I put these subplots into a for loop?
Since we don't have access to your data, I've made some assumptions. Most importantly, I'm assuming 'timex' is monotonically in...

7 years ago | 0

| accepted

Answered
To operate a function in all rows of matrix
The range() function computes the difference between max and min values. When the input is a matrix, it acts on the columns. T...

7 years ago | 0

| accepted

Answered
corrplot plotting on strange x and y axes values
Yeah, this is annoying. You can loop through each scatter plot and set the x and y limits to the x,y ranges within the data. ...

7 years ago | 2

Answered
How can I average one column based on the bins created for the other column?
This example creates a fake dataset to work with. It then creates bins for the elevation data in steps of 12. Using splitapply,...

7 years ago | 1

Answered
Visualize pressure on a cylinder surface
Assuming your data are stored in a matrix named 'data', X = reshape(data(:,1), length(unique(data(:,1))), []); Y = reshape(d...

7 years ago | 1

| accepted

Load more