回答済み
Accessing multiple fields in nested structures for string comparison
Assuming libinfo is a scalar structure, and hence libinfo.Raithinfo is a cell array, you may benefit from using cellfun (or arra...

約8年 前 | 1

| 採用済み

回答済み
How to create an array containing all possible combinations of 0's and 1's to length n
n = 3 c = arrayfun(@(k) mat2cell(dec2bin(0:2^k-1)-'0', ones(2^k,1), k), 1:n, 'un', 0) c = vertcat(c{:})

約8年 前 | 0

回答済み
Can I use unique to reduce one row, but keep reference to how many cells it was reduced from?
You are looking for some run-length encoding scheme: A = [ 1 1.5 2 2.5 3 3.5 4 4.5 5 10 10 10 20 20 3...

約8年 前 | 0

送信済み


allcomb(varargin)
All combinations of input (v4.2, apr 2018)

約8年 前 | ダウンロード 9 件 |

5.0 / 5
Thumbnail

送信済み


isfunction(FUN)
returns true for valid matlab functions (v3.2, apr 2018)

約8年 前 | ダウンロード 2 件 |

5.0 / 5

回答済み
I try to optimalize a temperature when looking at different concentrations for a chemical reaction. I get a good plot for values of k from 1 tot 70 but when going higher it won't work anymore. I don't know what to do, anyone?
You should reset t(1) to zero before the inner loop. You might not even need a vector t. Just use t = t + tstep, as you only use...

8年以上 前 | 0

回答済み
How does the for-cycle check its conditions?
You cannot change the parameters of the for-loop within the counter, as demonstrated here: a = 2 ; b = 6 ; c = 0 ; fo...

8年以上 前 | 1

回答済み
Find length of a structure element and remove them according to length?
L = arrayfun(@(k) numel(output(k).I), 1:numel(output)) output(L > 100) = [] ; % remove those elements of the structure arra...

8年以上 前 | 1

| 採用済み

回答済み
I want to know the cell number i.e. row and column of the matrix, whichever is above 10% of the normal vlaue. and i also want to get the values in the cell.
I am unsure if I understand your question completely, but here is my 2p: X = rand(4,3) % example data TF = X > 0.1 ...

8年以上 前 | 0

回答済み
linear fit of data
help polyfit

8年以上 前 | 0

回答済み
Is it possible to do this without for cycle?
% data Y = [1 1 3 2 3 1 1 2] % M = numel(Y) K = 3 % engine T = double((Y(:) - (1:K))==0)

8年以上 前 | 0

| 採用済み

送信済み


nextperm(V, K)
Next (lexicographic) permutation of values

8年以上 前 | ダウンロード 2 件 |

5.0 / 5
Thumbnail

回答済み
Add zeros to matrices same as length of another matrix
To pad an matrix A with zeros to match a larger or same-sized array B, you can use this: A = magic(3) B = ones(3, 5) ...

8年以上 前 | 0

回答済み
how do I convert a cell array of different size cells to a matrix
An easy job for padcat :) c = {{1 2}; {1 2 3};{4 5 6};{10 11 12 12 14}} % rather awkward cell array of cell arrays of n...

8年以上 前 | 0

回答済み
How to eliminate zeros from array
a(~logical(a)) = []

8年以上 前 | 0

回答済み
How to convert string to number and process underscores? (e.g. '57_77_' to 57.77)
all in one go: a = '12_23_' v = str2num(strrep(a(1:end-1), '_', '.'))

8年以上 前 | 1

回答済み
hi everybody , i'm a beginner and don't know how can i convert ascii to a string
A = [51 48 56 ; 73 48 71] str = char(A) % conversion from ascii to character string

8年以上 前 | 0

| 採用済み

回答済み
find max value within set parameters of matrix
If you want to mask out elements of a vector for finding the max, without disrupting the location within the vector, you might c...

8年以上 前 | 1

回答済み
Array indexing for moving IQR
When N (= number of elements in A) and K (= number of elements to use) are not too large you could create an intermediate (N-K+1...

8年以上 前 | 0

回答済み
Split a matrix at specific row
Use *mat2cell*: M = randi(20, 105,4) ; V = [11 12 11 11 12 12 13 11 12] ; C = mat2cell(M, V , size(M,2)) ;

8年以上 前 | 0

| 採用済み

回答済み
How to find minimal distance between elements?
Without creating a possibly large intermediate N-ny-N matrix or using a possibly slow sort V = [1 8 6 4 2 10] ; W = ncho...

8年以上 前 | 2

回答済み
How to find minimal distance between elements?
By definition the minimum distance is zero because v(i)==v(i) for any element i of the vector v. But I assume you want the mi...

8年以上 前 | 0

回答済み
assign values from logial vector to a new matrix with the same size
function B = functionA(A) B = A B(~(A>0)) = 0

8年以上 前 | 0

回答済み
Compare segments of a vector
A = [2 2 2 2 2 3 6 3 4 5 1 1 1 1 1 2 3 4 5 6] AA = reshape(A,5,[]) dA = diff(AA,[],2) ix = all(dA>0) ix = 2*fin...

8年以上 前 | 0

回答済み
Structs fields indexing issue
Parent.Child1.field_1 = [1 2 2 3] ; Parent.Child2.field_1 = [1 3 3 2 3 2] ; Parent.Child3.field_1 = [2] ; A = str...

8年以上 前 | 0

回答済み
How to choose all other indices than ones I know?
Here are two options a = [11 12 13 14 15] i = [2 3] b1 = nan(size(a)) b1(i) = a(i) b2 = a i2 = setdi...

8年以上 前 | 1

回答済み
Average distance of nonzero diagonal to the main diagonal for sparse matrix
In your example, you do not need to check the diagonals at all, just the first row and column of the matrix! A = [0 5 0 1 ...

8年以上 前 | 0

| 採用済み

回答済み
Average distance of nonzero diagonal to the main diagonal for sparse matrix
Use the second argument of diag? A = sparse(cumsum(triu(ones(5)),2)) diag(A,1)

8年以上 前 | 0

回答済み
How to Return two Matrix of dimension (T,N)
function [G, H] = MyInput(T,N) % do not name this function input, as this is already used by ML !!! G = zeros(T,N) ; % p...

8年以上 前 | 1

| 採用済み

回答済み
How to find sampling rate from a signal vector and a time vector?
The sampling rate is the number of samples collected per second. In most typical cases, this is (roughly) a fixed (single) value...

8年以上 前 | 3

さらに読み込む