回答済み
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...

8年弱 前 | 0

| 採用済み

回答済み
from a=[1 2 3 4] to b=[1 1 2 2 3 3 4 4]
b = repelem(a,2)

8年弱 前 | 3

| 採用済み

回答済み
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...

8年弱 前 | 0

回答済み
Index exceeds matrix dimensions.
After read the file type >> size(img) If the third dimension is not 3, it's not RGB image

8年弱 前 | 1

| 採用済み

回答済み
smooth 2D array and maintain boundaries
One way (bug edited version): <</matlabcentral/answers/uploaded_files/140348/Smooth2D.png>> % Generate fake data A = ...

8年弱 前 | 1

| 採用済み

回答済み
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...

8年弱 前 | 0

回答済み
Minimize non linear function with undefined vector
I'll save you some headache: the solutions are clearly x = ones(n,1);

8年弱 前 | 0

回答済み
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...

8年弱 前 | 2

| 採用済み

回答済み
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...

8年弱 前 | 2

| 採用済み

回答済み
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...

8年弱 前 | 0

回答済み
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),'.')

8年弱 前 | 0

回答済み
allocate values avoiding loop
A=[... 1.0000 1.0000 -1.1471 1.0000 2.0000 -1.0689 2.0000 1.0000 -0.8095 ...

8年弱 前 | 1

回答済み
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...

8年弱 前 | 0

回答済み
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,...

8年弱 前 | 0

回答済み
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...

8年弱 前 | 0

回答済み
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...

8年弱 前 | 1

| 採用済み

回答済み
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...

8年弱 前 | 0

| 採用済み

回答済み
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 ...

8年弱 前 | 1

| 採用済み

回答済み
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-...

8年弱 前 | 0

回答済み
How to generate a vector of two separate intervals without overlapping?
c = [a(randperm(length(a))) b(randperm(length(b)))]

8年弱 前 | 0

| 採用済み

質問


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

8年弱 前 | 1 件の回答 | 0

1

回答

回答済み
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...

8年弱 前 | 0

回答済み
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) ...

8年弱 前 | 0

| 採用済み

回答済み
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(:,[...

8年弱 前 | 1

| 採用済み

回答済み
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...

8年弱 前 | 1

回答済み
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...

8年弱 前 | 0

回答済み
Remove overlapping areas of 663 rectangles
<</matlabcentral/answers/uploaded_files/139889/unionrec.png>> data = xlsread('Rectangle points.xlsx'); data = reshap...

8年弱 前 | 1

| 採用済み

回答済み
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 =...

8年弱 前 | 2

回答済み
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...

8年弱 前 | 2

| 採用済み

回答済み
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...

8年弱 前 | 1

さらに読み込む