Respondida
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...

casi 7 años hace | 0

Respondida
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. ...

casi 7 años hace | 2

| aceptada

Respondida
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...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 1

| aceptada

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

casi 7 años hace | 1

| aceptada

Respondida
Finding cube with most Values
This FEX might help

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 1

| aceptada

Respondida
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,...

casi 7 años hace | 1

| aceptada

Respondida
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

casi 7 años hace | 1

Respondida
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,...

casi 7 años hace | 1

| aceptada

Respondida
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) ...

casi 7 años hace | 0

| aceptada

Respondida
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...

casi 7 años hace | 0

| aceptada

Respondida
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 ...

casi 7 años hace | 0

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

casi 7 años hace | 0

| aceptada

Respondida
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...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

Respondida
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]...

casi 7 años hace | 0

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

casi 7 años hace | 0

Respondida
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 = ...

casi 7 años hace | 0

Respondida
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...

casi 7 años hace | 0

Respondida
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(:,...

casi 7 años hace | 5

| aceptada

Respondida
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...

casi 7 años hace | 0

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

casi 7 años hace | 1

| aceptada

Respondida
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 ...

casi 7 años hace | 0

Respondida
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...

alrededor de 7 años hace | 1

Respondida
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(...

alrededor de 7 años hace | 1

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

alrededor de 7 años hace | 0

Respondida
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)

alrededor de 7 años hace | 0

Respondida
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...

alrededor de 7 años hace | 0

Pregunta


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...

alrededor de 7 años hace | 0 respuestas | 0

0

respuestas

Cargar más