Réponse apportée
Determining arrays require more than the available memory
Just answered in another thread https://www.mathworks.com/matlabcentral/answers/2016841-available-memory-error-in-matlab-quiz?s_...

presque 3 ans il y a | 1

Réponse apportée
i need to code speed ..anyone can help me? Getting rid of the loop would be a good start
clear v=[1 0 0 1]; d=[0.3 0 0 0.4]; count=1; gg=find(v); g={'Cycle n.',count}; j=1; clear b for h=1:numel(gg) b{j...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
How do you write a function that adds all odd numbers between 2 even numbers?
a = 2; b = 10; assert(mod(a,2)==0 && mod(b,2)==0 && a<=b, 'incorrect a or b') s = (b^2-a^2)/4

presque 3 ans il y a | 1

Réponse apportée
Operations on 3d array without using for loop
I don't have communication tbx, so I code this blindly l = 300; h = 400; a = randi([0,3], l, h); gf_k = gf(0:3,2); gf_a = g...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
How to build a structure that is easier to work with (i.e. for looping through and adding to)
If I was you I organize the data like this, just a linear array of structs load('structure.mat'); NewDataStruct = struct('Da...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
How to build a structure that is easier to work with (i.e. for looping through and adding to)
The first obvious thing NOT to do is having fields month_0 % ... month_5 Create a array 1 x 6 of structures months. if the i...

presque 3 ans il y a | 0

Réponse apportée
Calculate values of struct of struct
Single line (work for fields with struct NOT objects of class, struct is NOT some sort of class) s.s1.P = (1:20).'; % For simp...

presque 3 ans il y a | 1

| A accepté

Réponse apportée
Calculate values of struct of struct
Honestly I prefer the for-loop s.s1.P = (1:20).'; % For simplicity I have assigned dummy values to the "P "s. s.s2.P = (1:20)...

presque 3 ans il y a | 1

Réponse apportée
Detect datapoints deviating from the main, curved, cluster. Outlier detection
load('xy.mat') x = xy(:,1); y = xy(:,2); n = 65; xs = unique(x); m = numel(xs); edges = interp1(1:numel(xs), xs, linspace(...

presque 3 ans il y a | 0

Réponse apportée
Optimizing using fmincon in a "discrete" way
There is no problem for fmincon to optimize "discrete" variables as long as you can simuate the model with it, meaning you can s...

presque 3 ans il y a | 0

Réponse apportée
Get the analytical solution of inequalities in Matlab.
The real question is how would you get as formal decription of the so called "solution" of the equality linear system? There is...

presque 3 ans il y a | 1

Réponse apportée
Linear Algebra Error: Matrix is close to singular or badly scaled.
@Shrishti Yadav "I checked if the matrix reaches singularity and it does not. " Your A matrix has size 4 x 5, the the rank is m...

presque 3 ans il y a | 1

Réponse apportée
Are Matlab generated .eps files encoded as CYMK by default?
I doubt it. MATLAB color are RGB based. More discussion https://www.mathworks.com/matlabcentral/answers/499387-how-can-i-calcula...

presque 3 ans il y a | 0

Réponse apportée
Regularized SVD to find the least square solution
There is no MATLAB function that I'm aware of, you can build your own or look in file exchange, there are few posted there. Th...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
generate unrepeated pairs from randi
a = 0:5; b = -3:3; n = 20; % 5 in your case na = length(a); nb = length(b); [A,B] = ind2sub([na nb], randperm(na*nb, n));...

presque 3 ans il y a | 0

Réponse apportée
Logical indexing in tables with multiple targets
Note that what I wrote here is very similar to standard array. Sample = [0;1;1;2;2;2]; Data = [rand(1,5);rand(1,5);rand(1,5);...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
Is there a specific standard for the rows and columns of a struct?
You do whatever you prefer as programmer, there is no "standard" as long it is allowed by the language. This applies for array, ...

presque 3 ans il y a | 0

Réponse apportée
How to transform a table to a matrix?
T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1471061/spatialcurve.xls') A=T{1:end,2:end} % r...

presque 3 ans il y a | 1

Réponse apportée
Specify Multi core performance processor usage
It seems the general pattern is MATLAB uses performance cores first via native multi-threading, see Alison Eele in this thread ...

presque 3 ans il y a | 1

| A accepté

Réponse apportée
How to do LU factorization without permutation? The lu() is with permutation.
It is not possible for the simple reason that such decomposition without allowed permutation might not possible. For example I c...

presque 3 ans il y a | 1

| A accepté

Réponse apportée
how to speed ...i need very fast code
You want REALLY FAST code? Watch this, almost 100 time faster load('matlab_matri.mat') q=6062; %%I want to call this code and...

presque 3 ans il y a | 2

Réponse apportée
Block-diagonalize matrix based on specific block criteria
See symrcm symamd colamd commands and such

presque 3 ans il y a | 0

| A accepté

Réponse apportée
Help vectorizing code to improve speed
Here is a vectorized version of the for-loop. It is not faster according to this kind of test size and mask density, I'm littl...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
Smallest mask enclosing a polygon
To me there is no other way than detecting the border cross the edges of each "pixel" load('example.mat') P = example.shape;...

presque 3 ans il y a | 1

| A accepté

Réponse apportée
how to make the same length in the struct
load('matlab_sis.mat') Date = unique(cat(1,Sis.Date)); DAILYPROOF = nan(length(Date),length(Sis)); for k=1:length(Sis) s...

presque 3 ans il y a | 1

| A accepté

Réponse apportée
How to find the intersection values of line and curve?
OK I'll be nice with you because of your laziness I just copy the solution of another thread here; wirh a little adaptation to s...

presque 3 ans il y a | 0

| A accepté

Réponse apportée
What functions need GPU support
Matrix decomposition class seem not supported by GPU

presque 3 ans il y a | 0

Réponse apportée
Is there any matlab documentation that can explain why multiplying empty arrays gives zero matrices?
From group theory point of view, sum/product (group operator) of an empty set gives the group neutral element. The most basic ex...

presque 3 ans il y a | 2

| A accepté

Réponse apportée
What functions need GPU support
Some user usecases of interpolation that is not possible in cpu: https://www.mathworks.com/matlabcentral/answers/2009442-faster...

presque 3 ans il y a | 1

Réponse apportée
Error using interp3 "Error using griddedInterpolant. Grid arrays must have NDGRID structure"
Check with this for ns=1:length(obs_is) X = repmat(y_pts,[1 1 size(h,3)]); Y = repmat(x_pts,[1 1 size(h,3)]); Z ...

presque 3 ans il y a | 0

Charger plus