Answered
i want to get adjacency matrix of a network
Easier: function adj_matrix = generate_adjacency_matrix(n, p) adj_matrix=triu(rand(n)<p,1); adj_matrix=adj_matrix+a...

3 years ago | 0

Answered
Flipping the elements of a vector
First of all, I hope it is clear that you would never really flip a vector using either of the functions you've created. You wou...

3 years ago | 0

Answered
Edge and corner detection using Hough Transform
Because you are detecting edges/corners of a simple convex polygon, I would recommend downloading pgonCorners, https://www.math...

3 years ago | 1

| accepted

Answered
How to extract matrix elements corresponding to a logical matrix?
[I,J]=find(A==2); Q=A(min(I):max(I), min(J):max(J));

3 years ago | 1

Answered
How to extract matrix elements corresponding to a logical matrix?
P=(A==2); Q=A(any(P,2), any(P,1))

3 years ago | 1

| accepted

Answered
how to plot 3d oval shape with 81 nodes
An "oval" is a loose term. If you mean an ellipsoid, then you could use this FEX download, https://www.mathworks.com/matlabcen...

3 years ago | 0

Answered
Efficiently moving values in a 3-dimensional array
It will be much more efficient if you use the data ordering my_array = rand(n_columns,n_rows, n_populations) I will assume you'...

3 years ago | 0

| accepted

Answered
Efficient summing of parts of an array
I would recomend that you maintain the 4D array in ndSparse form instead, https://www.mathworks.com/matlabcentral/fileexchange/...

3 years ago | 0

| accepted

Answered
Angle between a vector and xy, xz, and yz planes
P1=[12,14,78]; Angles = 90 - acosd(normalize(flip(P1),'n'))

3 years ago | 2

Answered
Indexing in nested loops x 3
You are using '==' in several places in your code. When you do so, you must remember the limitations of floating point math, 0....

3 years ago | 0

| accepted

Answered
find duplicated rows in matlab without for loop
[~,I]=unique(x,'rows'); locations=setdiff(1:height(x),I) %locations of duplicate rows

3 years ago | 0

| accepted

Answered
While using fit function, how to make sure the generated fit is only of the range of data points ?
A fit does not have an inherent "range". Once the fit is computed, you can plot it over any range of x values that you wish, e.g...

3 years ago | 1

| accepted

Answered
Get separate index from a column with separate conditions
Remember, you are in a world of finite precision computers... ftol=@(t) abs(TIME-t)<smallnumber; %compare to within a tole...

3 years ago | 0

| accepted

Answered
Include all possible combinations in loop?
%% 'ConcreteData' (matrix 1030x8) R2_all = (value1,value2,value3,value4,value5,value6,value7,value8) %%pre-defined values exit...

3 years ago | 0

| accepted

Answered
How can I turn xyz position data with a hole into a closed surface to do more sophisticated lighting and transparency settings?
and my best attempt at a surface using boundary() You could try alphaShape instead. Choose the alpha radius to be slightly larg...

3 years ago | 0

| accepted

Answered
Issue with trainNetwork() function
I am trying to interpret what and how this darker blue field of the training plots means, The light blue line measures accuracy...

3 years ago | 0

| accepted

Answered
How to input 2D array data for Deep learing toolbox model, not image file
Currently, the data is in CSV format, but I can convert it into a suitable 2D array. An imageDataStore has a ReadFcn property ...

3 years ago | 0

Answered
Combine .mat files with 1x1 struct with 11 fields (tables)
Files=compose("eCRF%.3d", (1:200)); S = arrayfun( @(z)load(z).CRF, Files ); for f=string(fieldnames(S))' w...

3 years ago | 0

Answered
transform an empty matrix '0x0 double' into a matrix '0x1 uint8'
x=zeros(0,0); y=uint8( reshape(x,0,1) ); whos x y

3 years ago | 1

Answered
How can i find inside area of the geometry (2d) ??
Area = polyarea([x1;x2],[y1;y2])

3 years ago | 1

| accepted

Answered
How to fit an equation (catenary equation in 2D) to a 3D dataset (experimental data of a catenary curve in 3D) ?
In the Examples tab of this FEX page, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-oriented-tools-for-fitt...

3 years ago | 1

Answered
Uable to call the solutions in a system of linear equation
clear; a = sym('a',[1 5]) b = sym('b',[1 5]) ... Sol0 = vpa(S.b1) Sol1 = vpa(S.b2) Sol2 = vpa(S.b3) Sol3 = vpa(S....

3 years ago | 0

Answered
Calculating the sum of squared within cluster distances
The method you've posted is highly inefficient. You should just do, Dk=2*width(cluster)*(norm(cluster-mean(cluster,2),'fro')^2 ...

3 years ago | 1

| accepted

Answered
How to sum two cells element by element?
One way, A={1,2}, B={10,20}, C=cellfun(@plus, A,B,'uni',0)

3 years ago | 0

| accepted

Answered
Nlinfit error (jacobian's column are zero)
The best trouble shooting approach would be to first obtain the Jacobian at the solution by calling nlinfit with more output arg...

3 years ago | 0

| accepted

Answered
How do I prompt user to re-input value if first attempt is incorrect?
Something like this, perhaps? exit=false; msg='Please enter an R^2 value for Cement: ' while ~exit data = str2double( i...

3 years ago | 0

| accepted

Answered
Simultaneously fitting two non-linear equations with shared model coefficients
Since the error message is complaining about the initial point, you should check the value of modelfunc() at the initial point. ...

3 years ago | 0

Answered
How do I locate the most repeated elements in an array/vector?
Using this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetition...

3 years ago | 0

Answered
How to perform mathematical operation of arrays inside loop?
for i=1:N E=B-A*X; if norm(E,1)<1e-40, continue; end C=E.^2; X=lscov(A,B,1./C); end...

3 years ago | 1

Answered
Why there is a large numerical error in simple arithmatics?
You need to look at the relative errors. You will see that they are super-small: x = rand(1,1); x_1000 = x*1000; N = -20 : ...

3 years ago | 0

Load more