Question


Finding elements common to both arrays
Given A = [1 2 3 6 7 9 10]; B = [4 7 8 10]; How would I determine that 7 and 10 are common to both vectors? find(ismem...

2 years ago | 1 answer | 0

1

answer

Question


How do you set the x axis ticks / labels to be equal to the y axis ones?
I thought I could do this by the following, but it's not working: ax1 = gca; set(ax1,'XTick',get(ax1,'YTick')); Instead, ...

2 years ago | 2 answers | 0

2

answers

Question


Finding characters in a string / filename
How would I return as a double the number after the letter in the following file name? For instance, in the following, I would l...

2 years ago | 1 answer | 0

1

answer

Question


Finding the number of edges per each node in a graph
How do you find the number of edges per each node in an undirected graph? The following isn't quite what I want as it double cou...

2 years ago | 1 answer | 0

1

answer

Question


Alternative to writecell?
The function writecell was introduced in R2019a to write the contents of a cell array to a file. What would be the previous way ...

2 years ago | 1 answer | 0

1

answer

Question


Keeping the rows in an array with specified numbers
I want to keep the part of the array with specified numbers in column 2. This deletes the rows in the array with the specified n...

2 years ago | 1 answer | 0

1

answer

Question


Error with readtable function
I have a non-standard file format that I wish to read and run the following: Y = readtable(fileID.name,'FileType','text'); ...

2 years ago | 2 answers | 0

2

answers

Question


How to append a string to a filename when saving a file?
How do I append a string to the filename and save the file in the case of saveas and save? The following isn't quite right, so I...

2 years ago | 1 answer | 0

1

answer

Question


How to delete a row from an array if a specified column has specified numbers?
I want to delete a row from an array if a specified column has a specified number. How do I generalize the following if there is...

2 years ago | 1 answer | 0

1

answer

Question


How to delete all rows of an array that have a specified number in a particular column?
How can you delete a row of an array if the number in a particular column doesn't equal a specified number or even multiple numb...

2 years ago | 1 answer | 0

1

answer

Question


How do you vertically concatenate the rows of a cell array consisting of vectors of numbers?
I want to vertically concatenate the elements of a cell array so that, for example, an array that is 3 x 9 becomes 1 x 9. How do...

2 years ago | 3 answers | 0

3

answers

Question


How can you save a plot without generating the figure pop up?
I hope this makes sense - I want to save a plot without actually having the figure pop up window when I run the code. How do I d...

2 years ago | 1 answer | 0

1

answer

Question


How do you save a graph object?
I want to save a graph object so that I can access it when running MATLAB at a later time? How do I do this?

2 years ago | 1 answer | 0

1

answer

Question


How to append a vector to a cell array?
How do you append a vector to an existing cell array? Each element of the latter contains a vector with double precision. I want...

2 years ago | 2 answers | 0

2

answers

Question


Reading files in a specified order
I have multiple files of the same type in a directory that all have the same beginning, say "A11_K", followed by a numbers speci...

2 years ago | 2 answers | 0

2

answers

Question


How do you append a vector to another vector within a loop?
I calculate a vector within a for loop and wish to append all the vectors that I calculate in that loop together. How do I do th...

2 years ago | 1 answer | 0

1

answer

Question


Reading a massive file but skipping several lines / rows at a fixed interval
What is the most efficient way to read / analyze rows 1-1990 of an array, then skip 9 lines, then read rows 2000-3990, skip 9 ro...

2 years ago | 2 answers | 0

2

answers

Question


How to create a file and append a suffix?
How do you create a new file by appending a suffix like '.txt' or '.dat' etc. to an old file and then delete (to automate it - i...

2 years ago | 1 answer | 0

1

answer

Question


How to read this file in MATLAB?
I want to access the data in a file. The file is a TextEdit Document that appears to be unsupported. How do I do this? When I in...

2 years ago | 2 answers | 0

2

answers

Question


Fourier transform to reciprocal space vs. time-frequency transform
I have been trying to take an FFT of a function in real space to calculate an analagous quantity in "reciprocal space". My under...

2 years ago | 1 answer | 0

1

answer

Question


Taking the sum of exponentials
To do the calculation, is the following code correct? Is the (:) necessary? I think that makes a column vector, but I don...

2 years ago | 2 answers | 0

2

answers

Question


How to properly take the one-sided fft in MATLAB?
My understanding is that MATLAB's fft() function takes the two-sided FFT, and that the one-sided FFT has only positive frequency...

2 years ago | 1 answer | 0

1

answer

Question


How to properly take fft in MATLAB plus take real and imaginary components?
I wish to calculate the real and imaginary parts of the fft of a function f(t) that I can determine with arbitary time spacing. ...

2 years ago | 2 answers | 0

2

answers

Question


How to take the fft of a sum of exponentials?
A is a vector, and I want to take the sum of the exponential of -t/A_i over each element of A, then take the FFT. I wasn't sure ...

2 years ago | 2 answers | 0

2

answers

Question


How do you extract the elements of a cell that have the largest length?
Given a cell A, I can find the maximum length by [s,d] = cellfun(@size,A); out = max([s,d]); But how do I find the elemen...

2 years ago | 3 answers | 0

3

answers

Question


How can you remove all sub-graphs that are not part of the largest component of connected sub-graphs?
I imagine generating equivalence relations between the sub-graphs and doing some sort of union-find operation would be the way t...

2 years ago | 1 answer | 0

1

answer

Question


Building a graph from a matrix
Given an upper triangular matrix B that is ordered by the atoms in each molecule such that the atoms in molecule 1 come first, t...

2 years ago | 1 answer | 0

1

answer

Question


How can the following code be optimized / vectorized?
How can you optimize the following? It is painfully slow and takes around 5 minutes to run on my computer. Here I am calcuatling...

2 years ago | 3 answers | 0

3

answers

Question


Taking an inverse spatial fft in MATLAB
This is as much a conceptual question as a MATLAB question. I want to take an inverse fft of a function in reciprocal space and ...

2 years ago | 1 answer | 0

1

answer

Question


How do I integrate this multivariable function over just one variable?
How do you do you do the following like . (My actual function is more complicated, but this should suffice, I think.) Here, , ,...

2 years ago | 1 answer | 0

1

answer

Load more