Answered
How to access a field of a struct by indexing?
Yes, there is a way to get the nth field directly: fns = fieldnames(A); A.(fns{3}) But be aware that the order of the...

10 years ago | 26

Answered
Add some colums on the right date
Well, clearly from the error message, one of the column of |data| does not contain a valid date. Without seeing the data it' imp...

10 years ago | 0

Answered
Problem with my Matlab code
_"I'm using a open source script to make some calculation on my data"_ iThe script does no calcuation, It looks more like a s...

10 years ago | 1

Answered
Sum over all diagonals in lower matrix
A = reshape(1:30, 5, 6) %demo data rowdest = toeplitz(1:size(A, 1), [1, repelem(size(A, 1)+1, size(A, 2)-1)]); P = acc...

10 years ago | 0

Answered
How to vertical concatenate cell with strings
Using the new <https://www.mathworks.com/help/matlab/matlab_prog/create-string-arrays.html string> class introduced in R2016b, t...

10 years ago | 0

Answered
subtracting elements in a vector
diff(A) which will result in |[1 3 6 8]| not |[1 3 6 12]|

10 years ago | 1

| accepted

Answered
Adding dissimilar structures together (not overwriting similar field values)
Another variant of the function: function A = merge_dissimilar_struct(A,B) for fld = setdiff(fieldnames(A), fieldname...

10 years ago | 0

Answered
Plot titles in for loop with string and variable names
Use <https://www.mathworks.com/help/matlab/ref/sprintf.html |sprintf|> title(sprintf('Plot of stock %s', sec{1})); The f...

10 years ago | 1

Answered
What is the reason for this error and how can i solve it?
Your |x(x~=0)=x+1| only works because there are no 0 value in your |x|. It will fail with |x = [0 0.1]|. The correct syntax i...

10 years ago | 0

| accepted

Answered
Error for loop trough cell array
_" the plotting stops at the sixth security"_ for sec = 'ticker_list' iterates over the characters of the char array |'t...

10 years ago | 0

Answered
what is difference of Gaussian fliter
_"i dont know the concept Difference of Gaussian (DoG)"_ Then, find a book, research paper or even a <https://en.wikipedia.or...

10 years ago | 1

Answered
How to get control input if in workspace, u is stored as NaN ?
As the documentation of <https://www.mathworks.com/help/matlab/ref/nan.html |nan|> states, you can get NaN from: * Any arithm...

10 years ago | 0

| accepted

Answered
How can I convert 1D array into 2D array
There are a few things that are not quite right with what you're doing 1) you're using |x| and |y| as row, column respectivel...

10 years ago | 1

| accepted

Answered
Erroneous input into the allcomb function
The *single string* |'{''F'',''G'',''H'',''I'',''J''},{''K'',''L'',''M'',''N'',''O'',''P''},{''Q'',''R'',''S''},{''T''},{''O''}'...

10 years ago | 0

Answered
adding property dynamically in the class
A rule in any programming language: *if you*re numbering variables, you're doing it wrong*. These obviously related variables sh...

10 years ago | 1

| accepted

Answered
delete rows from cell array
I'm assuming that you want to delete repeated pairs regardless of the order the numbers appear in the pair. Possibly the easi...

10 years ago | 2

| accepted

Answered
replace an array with another array
A(32:41) = B

10 years ago | 2

| accepted

Answered
Help with the use of function
As per Jan's advice, the debugger is the best tool to use to find what is going wrong. _"if I execute the same command in th...

10 years ago | 0

Answered
Index exceeds matrix dimensions.
a = a; Pointless line of code that does nothing. &nbsp; something = [a]; Use of the concatenation operator, |...

10 years ago | 2

Answered
im2double, double and adapthisteq
_"will corss-correlation give different results"_ Yes, since the range of values will be different. *Will it matter?* For PIV...

10 years ago | 0

| accepted

Answered
Obtaining a maximum value from the third column of an array which is in a cell
The problem is nothing to do with arrays or cell arrays. it is to do with structure arrays. |stats{I}| is a structure array (...

10 years ago | 0

| accepted

Answered
How to check elements with value of 1’s in adjoining rows
~diff(A) & A(1:end-1, :) will show you which element of each row is identical to the one in the next row. You can transform...

10 years ago | 1

Answered
any faster way to load part of the mat file?
To efficiently use the benefits of |matfile| it is important to understand how matlab stores matrices in memory (and on file). M...

10 years ago | 1

| accepted

Answered
Why does my while loop not work for this specific data-set?
First, note that there is a bug in your code. If the while loop never get entered (if the sum is already exactly 1), then |a| ne...

10 years ago | 0

| accepted

Answered
How to assign a NAN to an empty cell in a cell array of cell array of matrix
As per James' comment it would probably be more useful to fix your thresholding code so it works on empty cells as well. Also...

10 years ago | 2

| accepted

Answered
Convert cell array of mostly strings into matrix of numbers
Have you tried using <https://www.mathworks.com/help/matlab/ref/readtable.html |readtable|> which is usually clever enough to fi...

10 years ago | 0

Answered
Finding the means of a large number of individual matrices.
You've really have numbered variables all the way up to |out_11091|? Wow! In this forum, we keep telling people not to use |e...

10 years ago | 2

| accepted

Answered
Set of indexes to vector without loop?
A |for| loop as per KSSV's answer is probably the best way to do this. cell2mat(arrayfun(@(s,e) s:e, IND(:, 1), IND(:, 2), ...

10 years ago | 0

| accepted

Answered
i need urgent help to understant
_"i want to know why he assume that width = 2 and what mean by " width = 2;"_ How should we know? We didn't write the code. A...

10 years ago | 0

Load more