Answered
how to use a (matrix) variable from one callback to another callback in GUI?
There are several ways to pass data between callbacks: <https://www.mathworks.com/help/matlab/creating_guis/share-data-among-...

8 years ago | 1

| accepted

Answered
By using reshape () in Matlab getting this error .
This img_size=size(img(:)); will return a 1x2 row vector equivalent to this: [numel(img),1] Then you get the siz...

8 years ago | 0

| accepted

Answered
GUI selecting multiple files with same amount of digits in filename
You could try something like this: Prefix = 'ID'; Pattern = [Prefix,'*sec.csv']; % better to match both prefix and fixed...

8 years ago | 0

| accepted

Answered
how to create a new folder mkdir, but naming that folder as input before running the code
The problem is that where you tried to access the new folder names you referred to the variable _name_, rather than to the _valu...

8 years ago | 0

| accepted

Answered
How to take alternating elements from two vectors?
Simpler: >> a3 = a1; >> a3(2:2:end) = a2(2:2:end) a3 = 1 22 3 44 5 66 7

8 years ago | 2

Answered
Help with this problem
Your dimensions were all messed up: note that |,| is used to concatenate the columns horizontally (you used |;| which concatenat...

8 years ago | 3

| accepted

Answered
How to randomly generate 0.1 or -0.1?
diag((2*randi(0:1,1,N)-1)/10)

8 years ago | 0

| accepted

Answered
How to concatenate variables from the workspace with a constant part in their name?
_"Any alternative idea for how this could be achieved?"_ Yes: simply avoid getting into the situation where you need to acces...

8 years ago | 2

| accepted

Answered
Looped function with variables that update - possible?
What I understand is that you want to provide both current |h| value (as provided to the function by |fminsearch| while it is op...

8 years ago | 0

| accepted

Answered
Convert 4D data to 3D
Why not just convert it to the correct shape in the first place?: A = your 9x1000x40x6 array C = squeeze(num2cell(permut...

8 years ago | 1

| accepted

Answered
Using assignin to create a dynamic name
Using dynamic names is a red-herring, and will only cause more troubles than it solves. Read this know why: <https://www.math...

8 years ago | 0

Answered
Save uniquely named variables in loop to a certain location
Do NOT concatenate paths/directories. The recommended method is to use <https://www.mathworks.com/help/matlab/ref/fullfile.html ...

8 years ago | 0

| accepted

Answered
am trying to get the non zero minimum values from all the rows. Am getting the correct minimum values but the indices for minimum values for the first and second rows are wrong. Suggest me where I am wrong
There is no point in wasting your time writing ugly |for| loops, because the MATLAB function <https://www.mathworks.com/help/mat...

8 years ago | 2

Answered
How to make a matrix based on other values in a matrix that 'match'
Based on <https://www.mathworks.com/matlabcentral/answers/396578-how-to-make-a-matrix-of-values-based-on-values-in-another-matri...

8 years ago | 0

| accepted

Answered
How to make a matrix of values based on values in another matrix
The trick is to use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>, and remember that MATLAB operates down c...

8 years ago | 0

| accepted

Answered
Combine multiple tables into the one
As I wrote earlier, simply |load| into a structure. Then you convert the struct to a cell, and it is then trivial to concatenate...

8 years ago | 0

Answered
How to pull out elements of a matrix based on certain conditions
Where |M| is your matrix: reshape(M(M(:,2)==1,3:4).',[],1) or tmp = M(M(:,2)==1,3:4).' tmp(:)

8 years ago | 0

| accepted

Answered
How to put elements of a matrix into another matrix.
Where |M| is your matrix: reshape(M(2:4,3:4).',[],1) or tmp = M(2:4,3:4).'; tmp(:)

8 years ago | 0

| accepted

Answered
Calling function for blockproc
As its help explains, <https://www.mathworks.com/help/images/ref/blockproc.html |blockproc|> supplies a structure to the called ...

8 years ago | 0

| accepted

Answered
How to generate an event in matlab every second
<https://www.mathworks.com/help/matlab/ref/timer-class.html> <https://www.mathworks.com/help/matlab/matlab_prog/use-a-matlab-...

8 years ago | 2

Answered
newbie user math problem
To get one solution within a range where there is a zero intersect: >> fun = @(x) sin(x)-sin(1.57)*exp(-(2*pi-x+1.57/2010.6...

8 years ago | 1

| accepted

Answered
Can someone help me code "Add the first row to every row other than the first row" for this setup?
Simpler: M(2:end,:) = M(2:end,:) + M(1,:)

8 years ago | 1

Answered
How to create a specific diagonal Matrix
That is exactly what <https://www.mathworks.com/help/matlab/ref/blkdiag.html |blkdiag|> is for: >> V = [1,1,1]; >> blkdi...

8 years ago | 0

Answered
make many matrices with for loop
It is easy to split an MxNxP array into P separate arrays: just use |num2cell|. Note that MATLAB is a high-level language, so so...

8 years ago | 1

| accepted

Answered
how can i make a function that accepted only squared and positive matrices?
|fun| returns |true| IFF the input is a square matrix with positive values: >> fun = @(M) ismatrix(M) && diff(size(M))==0 &...

8 years ago | 0

Answered
indices of a spiral
Not quite one line, but you can use |sort| and |ind2sub| for this: >> M = spiral(3) M = 7 8 9 6 1 2 ...

8 years ago | 1

| accepted

Answered
Could anyone help me to fix the issue.
You need to specify the dimension to operate over: >> max(iwant1,[],3) ans = 5.9587 4.4256 5.3430

8 years ago | 0

| accepted

Answered
How to remove rows that do not contain or match a specific 'string'
For a cell array you can use <https://www.mathworks.com/help/matlab/ref/ismember.html |ismember|>: Vars = { 'Subject' 'M...

8 years ago | 0

Answered
reorganize two related matrices in ascending order
This is easy with <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: >> A0 = [-1,1,-1,1;-1,-1,1,1;1,1,-1,-...

8 years ago | 0

| accepted

Answered
Unexpected MATLAB expression.
Simply pasting individual numbers does not define a vector: they need to be specified within square brackets. Currently those va...

8 years ago | 0

| accepted

Load more