Réponse apportée
Concatenate Structures: select structures only if not empty.
This clearly shows the drawback of naming your variables dynamically, like A1, A2, A3, A4. If you change, for instance, the way ...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
How to find slope of this line
You can create a complete list of x,y pairs by expanding x to the size of y. Looking at your code, I think a single element of x...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
Dissect a String and create list with Matlab
A = "black || white || pink || yellow" B = split(erase(A,'|')).'

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
Removing NaNs from a struct
TF = arrayfun(@(k) isnan(AllData.Passive(k).T(1)), 1:numel(AllData.Passive)) AllData.Passive(TF) = []

plus de 5 ans il y a | 1

Réponse apportée
Changing Indexing Order in matrix raws
Your question is a little confusing, but here is my take on it: A1 = [0 0 0 0 0 0 0 0 0 1 2 3 4 5] A2 = [12 11 14 5 1] out([n...

plus de 5 ans il y a | 1

Réponse apportée
Repeating a function n times with different values from a vector
If you organize the input differently, this is not so difficult x = [1 2 ; 3 4 ; 5 6] ; % organized into rows N = size(x,1) ; ...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
i have a question that works backwards
What about % X is known F = X D = ones(size(F)) % F ./ (D.^5) equals X or is this to simply thought by me ;-)

plus de 5 ans il y a | 0

A soumis


nchoosekcom
NCHOOSEK with its complementary combinations

plus de 5 ans il y a | 1 téléchargement |

Thumbnail

Réponse apportée
How can i use nchoosek to output both the k combinations and the remaining combinations?
The remaining values can simply be obtained using nchoosek(1:n, n-k), you just have to flip the order of the output :-) n = 7 ...

plus de 5 ans il y a | 2

Réponse apportée
How to create a matrix from for loop result?
D = [170, -80, -30, 0, -50, -30, 20, -60, 100, -60 -20]; Iplus=find(D>0); A = [] ; % initialize for i=1:size(Iplus,...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
How to select desired row
ix = [0:224:81563]' + 1:112 ; % calculate row indices ix(ix>size(A,1)) = [] % remove row indices that are too larger A2 = A(ix...

plus de 5 ans il y a | 1

| A accepté

A soumis


permsk
All permutations of K elements from an array (set)

plus de 5 ans il y a | 1 téléchargement |

Thumbnail

Réponse apportée
How to change character in multiple cells in to number 0 and 1?
Sex = {'F','M','F','F','M','M','F'} [~, SexNum] = ismember(Sex, {'F','M'}) SexNum = SexNum - 1 % 1 = 'M', 0 = 'F', -1 = other ...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
load files whith a previus specified name
Didn't you just make a simple typo? % Aplha vs Alpha % | |

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
Using numpad 8 2 6 4 as North South East West
Perphaps my getkey function may be of use to you: https://www.mathworks.com/matlabcentral/fileexchange/7465-getkey

plus de 5 ans il y a | 0

Réponse apportée
I keep getting the error message that vectors must be the same length in the plot command
So, apparently the two vectors are not of the same length. You really should learn how to debug your own code. Set a breakpoint ...

plus de 5 ans il y a | 1

Réponse apportée
Select random elements from three consecutive columns in a big matrix?
M = magic(5) % input data N = 4 % number of selections nC = 3 % number of consecutive columns % engine szM = size(M) r...

plus de 5 ans il y a | 0

Réponse apportée
select random row inside the cell
You want the row, or the row number to be returned? A={[1,4,6;6,5,4;1,2,4],[1,3;5,4],[1,2;1,7;6,8]} rownumber = cellfun(@(c)...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
Writing a Matrix 6x6 in one line
help reshape

plus de 5 ans il y a | 0

Réponse apportée
Vectorizing nested for loops
A = magic(5) d = squareform(pdist(transpose(A))) % transpose to obtain vecnorm between columns pdist and squareform are part ...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
how to find the element which is greater than or equal to its row and smaller or equal to its column in a matrix
function out = saddle(M) [r, c] = ind2sub(size(M), 1:numel(M)) ; tf = arrayfun(@(r, c) all(M(r, c) >= A(:, c)) && all(M(r, c) ...

plus de 5 ans il y a | 0

Réponse apportée
omit same element inside cell
You can convert the elements of each cell to a char array and apply unique on that cell array of chars. A = {[1,2,3,4],[4,2,3],...

plus de 5 ans il y a | 1

Réponse apportée
How to store vectors into a matrix that have different sizes?
Next to cell arrays, you can also use struct arrays, which can be more ... euh ... structured than cell arrays ;-) a(1).data = ...

plus de 5 ans il y a | 0

Réponse apportée
Repeating or rerunning a loop
Use a while loop, which is more flexible than a for -loop. Something like this might work: seq = [3, 1, 2, 1, 3, 2]; % trial se...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
Probability of exactly one even number
I suggest you use two counters: one counting the numbers of even values in a single throw, and one counting the number of throws...

plus de 5 ans il y a | 1

Réponse apportée
How can I get a infinite loop in matlab?
an infinite loop k = 0 ; while true % useful code here k = k + 1 ; disp(k) end But are you sure you want an...

plus de 5 ans il y a | 2

Réponse apportée
How to use varargin: to specify a second input variable with separate output
You cannot compare strings with different lengths using ==. Use isequal or strcmpi instead, for instance: if isequal(lower(vara...

plus de 5 ans il y a | 1

| A accepté

Réponse apportée
Removing a Range of Elements from an array
ix = find(M(:,12) > 750, 1, 'first') % find the row index of the first element in the 12th column of A being larger than 750 M...

plus de 5 ans il y a | 0

Réponse apportée
How do i average all result in total loop,if some result in some of loop are NaN
Store each result in an array and average after the loop. An example: c = nan(1,10) ; % pre-allocation for speed for k = 1:10 ...

plus de 5 ans il y a | 0

| A accepté

Réponse apportée
Counting occurrences of a pair of numbers in a logical vector
A vectorised alternative: A = [0 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1 ]; % Input vector ix = find(A) ix = ix(2:2:end) B = cumsum(...

plus de 5 ans il y a | 0

Charger plus