回答済み
How to find the intersection of multiple arrays (or rows of a matrix) in a short code
Put in the cell then use comma list systax: c = {a, b, c, ...}; % or use mat2cell, num2cell depends how you store your 172 vect...

4年弱 前 | 1

| 採用済み

回答済み
2D Interpolation of data
You have scattered data, you should use scatteredInterpolant or similar, not interp2.

4年弱 前 | 0

| 採用済み

回答済み
Load an array instead of a struct with fields
Do this when loading, Container = load('Saving.mat'); Saving = Container.Saving; Check out doc of save ans struct so you won...

4年弱 前 | 1

| 採用済み

回答済み
scatteredInterpolant function is providing too much noise in interpolation
The problem raises from the fact that scatteredInterpolant use Delaunay triangulation, meaning that X and Y are assumed to have ...

4年弱 前 | 1

| 採用済み

回答済み
Without resorting to FEX/MEX, can the overhead of repeated calls to sparse() be avoided with operations on I, J, V directly?
EDIT: Here is the final code. Method used in B2 is the fatest; M = 10000; N = 10000; N_k = 100; A_k = cell(1,N_k); for k=1:...

4年弱 前 | 0

| 採用済み

回答済み
Does intlinprog use cuts during its Branch and Bound Algorithm?
The document CutMaxIterations: Number of passes through all cut generation methods before entering the branch-and-bound phase,...

4年弱 前 | 0

| 採用済み

回答済み
Vectorized way to assign columns/rows of matrix to struct array's field
split = num2cell(matrixToAssign,1); [structArray.field] = deal(split{;});

4年弱 前 | 0

回答済み
What is the best smoothing procedure to calculate differentials for a large number of data points (x,y)?
The Savitzky-Golay filter (moving polynomial fit) is a good filter that preserves decendly the slope. There is a similar thread...

4年弱 前 | 2

回答済み
Dot indexing is not supported for variables of this type??? Parfor loop, and global variable
The global variable is not accessible by the workers, and it will return EMPTY when you are trying tp access to it. Soo if you a...

4年弱 前 | 0

回答済み
sum of different columns to the desired value in Matlab
A=randi([4 30],10,1); lo = [1 1 1 1]; up = [10 10 5 5]; BCDE=lo+diff(round((cumsum([0, (up-lo)],2)).*(A-sum(lo))./sum(up-lo...

4年弱 前 | 1

| 採用済み

回答済み
sum of different columns to the desired value in Matlab
If you have the optimization toolbox A=randi([4 30],10,1); n = length(A); lo = [1 1 1 1]; up = [10 10 5 5]; m = length(up...

4年弱 前 | 1

回答済み
How to ask matlab to find mean only if there are less than 3 NaN values?
qq = [1 2 3 NaN; 1 NaN NaN NaN]; qqm = mean(qq','omitnan'); qqm(sum(isnan(qq),2)>=2) = NaN; qqm

4年弱 前 | 0

| 採用済み

回答済み
Backslash does not provided the solution with the smallest 2-norm
Few other methods to get least-norm solution A = rand(3,6) b = rand(3,1) % Methode 1, Christine, recommended x = lsqminnor...

4年弱 前 | 1

回答済み
Speeding up lsqlin to find the base of a matrix
Can you try this: A = mu-eye(size(A)); [Q,R,p] = qr(A,'vector'); n = [R(1:end-1,1:end-1)\R(1:end-1,end); -1]; n(p) = n/sum(n...

4年弱 前 | 1

| 採用済み

回答済み
Trying to parallel compute a function
"or maybe MATLAB automatically does this and my function is already running in parallel?" No. But if you vectorize your funct...

4年弱 前 | 0

回答済み
AUC or trapz for irregular shape that intersects itself
I use data you provided on other thread (the excel is horrible to read, if you could provide the data in mat file format it's be...

4年弱 前 | 0

| 採用済み

回答済み
Each PARFOR Worker Writes to the Same File
May be (I didn't test) you could write in binary file at a deterministic place: fileID = fopen('Results.bin','wb'); parfor ......

4年弱 前 | 0

| 採用済み

回答済み
How do i insert one value from one array to another array
See if s is what you want or not (not clear for me) A = [1,2;2,1;1,1;1,3;3,2] B = [0.5,0.5;2,2] k = dsearchn(B,A) AA = ...

4年弱 前 | 0

| 採用済み

回答済み
I need to repeat numbers in an array with a certain number of repetitions for each value without(repelem or repmat)
The old for-loop list_1 = [2;3;5;6]; list_2 = [1;4;3;1]; r = zeros(sum(list_2),1); start = 0; for k = 1:length(list_2) ...

4年弱 前 | 1

回答済み
I need to repeat numbers in an array with a certain number of repetitions for each value without(repelem or repmat)
Why prefer a simple method when one can do in a complicated manner: list_1 = [2;3;5;6] list_2 = [1;4;3;1] idx=cumsum(accuma...

4年弱 前 | 1

回答済み
How to generate a smooth derivative after fitting a curve to the data?
You have to FIT the spline, not interpolate. For example I use my own tool BSFK avalable in FEX. load Data.mat; pp = BSFK(x,y...

4年弱 前 | 0

| 採用済み

回答済み
how to bound voronoi polygons
Transform the voronoi cells to polyshape object, you can then make the intersection of the region you want to use to clip (the b...

4年弱 前 | 0

回答済み
How can I get permutations of a vector satisfying the given condition?
There are 9918 permutations according to this code B= [0 2 0 13 0 0; 1 3 0 14 0 13; 2 4 0 15 0 14; 3 5 0 16 0 15...

4年弱 前 | 1

| 採用済み

回答済み
How can I delete a row based on the value of the previous row?
If your data is sorted you could try this A = 1:0.1:10 A = uniquetol(A,2*(1-eps),'DataScale',1)

4年弱 前 | 0

回答済み
How can I delete a row based on the value of the previous row?
This avoids deletetion which like growsing array wouls kill the performance. A=[10, 11.5, 13.3 13.5 13.7 17]; keep = false(s...

4年弱 前 | 1

回答済み
2D sliding/moving/running average window
Just some hint if your want to implement efficiently using loop : To do mean, you might do sliding sum onf the data, then divid...

4年弱 前 | 0

| 採用済み

回答済み
question about command 'mat2cell'
I = rand(128,256); n = 16; mat2cell(I, n*ones(1,size(I,1)/n), n*ones(1,size(I,2)/n))

4年弱 前 | 0

| 採用済み

回答済み
How can I create a Delanay point in a cube?
A cube can be devided in 6 tetrahedra nx=4; ny=3; nz=2; grid = arrayfun(@(n)linspace(0,n,n+1),[nx,ny,nz], 'unif', 0); [gr...

4年弱 前 | 0

| 採用済み

回答済み
How do I put my values in certain bins and retrieve the values from the highest count bin
Adapt this to your need % Example data A=rand(2,3,20); A(randi(numel(A),1,10))=0; [m,n,p] = size(A); edges = 0:0.1:1; A(...

4年弱 前 | 1

| 採用済み

回答済み
How to generate all possible permutations of an array having numbers from 1 to 24?
perms(1:4) % toy example perms(1:24) % what you ask is Why? Because you need (factorial(24)*24*8)/(1024^4) =~ 10^14 Tera b...

4年弱 前 | 1

さらに読み込む