Answered
Combine three matrices (every other column)
rfun = @(x) reshape(x,[1 size(x)]); D = reshape([rfun(A);rfun(B);rfun(C)],[],size(A,2)) The second method looks shorter but it...

7 years ago | 0

Answered
Expected one output from a curly brace or dot indexing expression, but there were 2 results.
In general you are not allow to assign multi-level structures with non-scalar indexing in one shot, you need to do in 2 steps. ...

7 years ago | 2

| accepted

Answered
How to properly convert variable names into a chain of strings in Matlab?
a = 1; b = 2; savevars('myfile.mat', a,b); function savevars(file, varargin) v = varargin; f = cell(size(v)); for k=1:le...

7 years ago | 0

Answered
How to properly convert variable names into a chain of strings in Matlab?
If you use number in variable name then you'll run into trouble soon or later. Just don't do it. Not sure the advantage of usi...

7 years ago | 1

| accepted

Answered
How to remove data from a real-time plot after a certain period of time?
Have you seen the 'MaximumNumPoints' option of animatedline()?

7 years ago | 1

| accepted

Answered
Finding cube with most Values
This FEX might help

7 years ago | 0

Answered
Modifying a structure array
S=struct; S(1).f1=5*[2,3,4,5,6,7,8,10,14,16,18,20]; S(1).f2=5*[3,6,9,12,15,18,21,24,27,30,33,36]; S(2).f1=40:120;S(2).f2=60:1...

7 years ago | 1

| accepted

Answered
Scaling of vectorized code which is limited by memory access
Here is my C-mex implementation, on my laptop it accelerates by 20 fold from your original MATLAB code (compiled with MSVS 2017,...

7 years ago | 1

| accepted

Answered
Determining values in array (of 1s and 0s) that neighbour similar values
If you have Image Processing tbx you might take a look at imerode

7 years ago | 1

Answered
Need to Split a column of type 'string' in a Table in to group of 4 characters giving new names to the result.
s=[ "65 00 69 00 6D 00 75 00 "; "B7 FF E5 FF 7D 10 01 00 "] c = char(s); c(:,3:3:end)=[]; ssplit = string(mat2cell(c,...

7 years ago | 1

| accepted

Answered
How to convert matrix to cell array?
c = mat2cell(A,4,4*ones(1,35)) If you want nested cell as well, do that after the above c = cellfun(@num2cell, c, 'unif', 0) ...

7 years ago | 0

| accepted

Answered
avoid for loop in a specific code
predicted_target = {'1'; '0'; '0'; '1'}; Target = {'0'; '1'; '1'; '1'}; prefix = {'E'; 'c'} new_classes = strcat(prefix(str...

7 years ago | 0

| accepted

Answered
could anyone help me to solve the issue
Ypu can use assignment optimal problem to solve it, one implementation is in FEX Munkres algorithm A=[ 0 0 ...

7 years ago | 0

Answered
change entry of sparse matrix
Change it exactly like regular (non-sparse) matrix: A(sub2ind(size(A), inx, inx)) = out

7 years ago | 0

| accepted

Answered
mex crash with fftw calls
I can't remember having issues using FFTW with MATLAB. I use on Windows platform and I'm sure my code work for R2015a up to R201...

7 years ago | 0

Answered
Fit data to part of an ellipse
Arbitrary oriented elllipse in this thread If you want ellipse aligned with x/y you need to remove the cross term xc.*yc (or fo...

7 years ago | 0

Answered
What's the best way to check if a system of one equation and one inequality has any solution?
In your case use first Euler-Lagrange condition gives one solution if it exists meaning find lambda, x, y, st [2*x/25, 2*y/25]...

7 years ago | 0

Answered
Best File Exchange ever !!!
I give my vote for https://fr.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensiona...

7 years ago | 0

Answered
How to perform piece-wise linear regression to determine break point?
Another tool is my FEX BSFK load('Sample2.mat') BSFK(Sample2(:,1),Sample2(:,2),2,[],[],struct('annimation',1)); ans = ...

7 years ago | 0

Answered
arrayfun isreal fails - how to fix?
Guys ISREAL tests whereas the internal storage of an array does not allocated memory for the imaginary part, it is NOT testing t...

7 years ago | 0

Answered
Circle least squares fit for 3D data
X=csvread('data.csv'); XC = mean(X,1); Y=X-XC; [~,~,V]=svd(Y,0); Q = V(:,[1 2]); % basis of the plane Y=Y*Q; xc=Y(:,...

7 years ago | 5

| accepted

Answered
Fseminf can't be used if the constraints' dimsion is higher than 2?
If you have one inequality (doesn't matter how the lhs is computed, with finite or infinite series or products), then you have O...

7 years ago | 0

Answered
Indexing numbers for 2 or more specific values in a vector?
h = find(vec==26 | vec==437) or h = find(ismember(vec,[27 437]))

7 years ago | 1

| accepted

Answered
Fast multiplication: binary matrix with double matrix
Here is two ways, it won't be faster than A*B as other has warned you n = 512; A = sprand(n,n,0.1) > 0 ; B = rand(n,n); m ...

7 years ago | 0

Answered
Return all possible Cuts of array A If you have defined number of parts M
Code for your latest request of overlap outputs. A = [1 2 3 4] cuts = 2 N = length(A); c = nchoosek(1:N-1+cuts,cuts)-(1:cu...

7 years ago | 1

Answered
Return all possible Cuts of array A If you have defined number of parts M
A=[1 2 3 4 5 6] M = 2; N = length(A); C=nchoosek(1:N-1,M); n=size(C,1); C=[zeros(n,1), C, length(A)+zeros(n,1)]; m=diff(...

7 years ago | 1

Answered
Unfold 3D I x J x K to 2D I x JK
X=M(:,:)

7 years ago | 0

Answered
linear optimization using optimization toolbox and minimize array sum
Diff= abs(D-TH); Now I want to minimize the sum of "Diff" Threshold = median(D)

7 years ago | 0

Answered
How to generate all collections of n subsets of 1:v?
v = 2; n = 3; B = 1:2^v-1; c = repmat({B},1,n); [c{:}] = ndgrid(c{:}); c = cat(n+1,c{:}); c = reshape(c,[],n); B = arrayf...

7 years ago | 0

Question


Warning on PERSISTENT statement
I know that PERSISTENT statement is slow, and try to overcome by passing an logical argument to by-pass when I know the function...

7 years ago | 0 answers | 0

0

answers

Load more