Réponse apportée
Searching a huge array with a for loop - How to increase speed?
ts = datenum('20130102 00:00:00:000', 'yyyymmdd HH:MM:SS:FFF'); te = datenum('20170731 23:00:00:000', 'yyyymmdd HH:MM:SS:FF...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
from a=[1 2 3 4] to b=[1 1 2 2 3 3 4 4]
b = repelem(a,2)

plus de 7 ans il y a | 3

| A accepté

Réponse apportée
Interpolation of R^3 -> R^3
(*NOTE*: my post is not easily to be followed since the RGB description has been removed.) Assuming RGB5 is (n x 3) first set...

plus de 7 ans il y a | 0

Réponse apportée
Index exceeds matrix dimensions.
After read the file type >> size(img) If the third dimension is not 3, it's not RGB image

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
smooth 2D array and maintain boundaries
One way (bug edited version): <</matlabcentral/answers/uploaded_files/140348/Smooth2D.png>> % Generate fake data A = ...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How to connect two polygons with a perpendicular line? The line doesn't have to be at the actual points, just somewhere on the outer shape connected to the inner shape. I used roipoly to create the polygons.
Apply <https://fr.mathworks.com/matlabcentral/fileexchange/34869-distance2curve this function> with vertexes of one polygonal to...

plus de 7 ans il y a | 0

Réponse apportée
Minimize non linear function with undefined vector
I'll save you some headache: the solutions are clearly x = ones(n,1);

plus de 7 ans il y a | 0

Réponse apportée
I would like to separate a matrix into different matrices based on a cycle of the first values
A=[1 2 3 1 2 4; 1 1 1 2 2 2]; lgt = diff(find([true,diff(A(1,:),1,2)<0,true])); C = mat2cell(A,size(A,1),lgt); Re...

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
how can i randomly sample from a matrix and determine the remaining part?
D2=D(setdiff(1:end,c),:) or b = ~logical(accumarray(c(:),1,[size(D,1) 1])); D2 = D(b,:); or b = true([size...

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
Extrapolating from linear fit
" _Currently, it plots a line over my data. How can I specify the limits of the linear fit (I'd like to extrapolate)._" You g...

plus de 7 ans il y a | 0

Réponse apportée
how do i generate coordinates with a set of restrictions?
xyz=rand(10000,3)*4-2; % with in (-2,2) figure plot3(xyz(:,1),xyz(:,2),xyz(:,3),'.')

plus de 7 ans il y a | 0

Réponse apportée
allocate values avoiding loop
A=[... 1.0000 1.0000 -1.1471 1.0000 2.0000 -1.0689 2.0000 1.0000 -0.8095 ...

plus de 7 ans il y a | 1

Réponse apportée
Verifying a region is covered using circle covering
One way to check is to build the Voronoi cells from the seeds that are the centers of the circles. Then for each Voronoi cell...

plus de 7 ans il y a | 0

Réponse apportée
How to randomly pick number from the vector and assign it to the element from the struct vector?
>> s=struct('whatever',cell(1,10)) s = 1×10 struct array with fields: whatever >> x=rand(1,...

plus de 7 ans il y a | 0

Réponse apportée
Delaunay Triangulation with a hole in the domain
Why reinvent the wheel? <https://fr.mathworks.com/matlabcentral/fileexchange/25555-mesh2d-delaunay-based-unstructured-mesh-gene...

plus de 7 ans il y a | 0

Réponse apportée
How to count the top five pairs (for each digit) which have the highest number of occurrences in a cell array?
C = {[1; 3; 5; 4; 6]; [1; 2; 3; 4; 5; 6; 7]; [1; 4; 3; 6]}; % generate list of all pairs from C elements u = unique(ca...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How to create a random permutation from two sets of numbers in one vector?
Separation in alternate groups c = [1 2 6 3 7 8 4 9 5 10]; from_a = c <= 5; % change accordingly, logical array, TRU...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
How to generate correlated random sources drawn i.i.d from an arbitrary joint distribution in matlab?
m = 1000000; % size of the files % 2 groups % group1 3 files C12 = 0.2; C23 = 0.2; C13 = 0.2; G1 = [1 ...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
How to find the roots of large number of polynomials arranged in matrix array
A vectorized code can be derived from this <https://math.stackexchange.com/questions/785/is-there-a-general-formula-for-solving-...

plus de 7 ans il y a | 0

Réponse apportée
How to generate a vector of two separate intervals without overlapping?
c = [a(randperm(length(a))) b(randperm(length(b)))]

plus de 7 ans il y a | 0

| A accepté

Question


How TABLE retreive the variable names?
This example from the doc shows |table| is able to retrieve the variable names of the iput arguments list and uses them as colum...

plus de 7 ans il y a | 1 réponse | 0

1

réponse

Réponse apportée
Is it possible to vectorize this?
The orginal method is quite fast, for random intervals (they cover 50-60% of x) on my computer it takes 1.7 ms in average. Guill...

plus de 7 ans il y a | 0

Réponse apportée
Average based on logical mask and condition
Just put NaN on the 3km-grid at the place you want to discard Grid_3km_Masked = Grid_3km; Grid_3km_Masked(YourMask==0) ...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
create cell array based on unique combinations in two columns
data=ceil(4*rand(20,3)) [m,n] = size(data); B = sortrows(data,[1 2]); G = mat2cell(B,diff([0; find(any(diff(B(:,[...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
create cell array based on unique combinations in two columns
data=ceil(4*rand(20,3)) [~,~,J] = unique(data(:,[1,2]),'rows'); G = accumarray(J(:),(1:length(J)),[],@(r) {data(sort...

plus de 7 ans il y a | 1

Réponse apportée
Is it possible to vectorize this?
For generic x, A, no there is no direct way. What you might do is decomposing the set of intervals in bigger set of non-overl...

plus de 7 ans il y a | 0

Réponse apportée
Remove overlapping areas of 663 rectangles
<</matlabcentral/answers/uploaded_files/139889/unionrec.png>> data = xlsread('Rectangle points.xlsx'); data = reshap...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
how do i discretize negative integers
_"This works for positive integers only."_ Wrong claim. It works for negative numbers, histc(-1.5,[-3 -2 -1]) ans =...

plus de 7 ans il y a | 2

Réponse apportée
Find the most common string out of all the strings
Edit: bug fix s1 = 'Romeo' s2 = 'Juliet' s3 = 'Rambo' s4 = 'Juliet' s5 = 'Romeo' s6 = 'Romeo' c = {s1...

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
How to construct a combinatorics array from two data sets with each combination having a specified number of elements?
Sad, people keep asking unreasonable thing. The number of combinations is 2^80, Each of those is 100 numbers so the size...

plus de 7 ans il y a | 1

Charger plus