Question

Contour plot with function triplot
Hi all, I have a script which plots a structure: clear; clc; clf; % nodal coordinates. coord = [0 0; 1 0; 2 0; 3...

4 years ago | 0 answers | 0

0

Question

Efficient way of storing a triangular matrix
Hi all, I have some pretty large upper triangular matrices to store and to be used like this: <</matlabcentral/answers/upl...

4 years ago | 2 answers | 1

2

Question

Hi all, Is there a way to add comments to variables dynamically? For example, in my code, if I type this variable in command ...

4 years ago | 5 answers | 5

5

Question

Sort cell elements according to one column
Hi all, I have a cell array like this: K>> err err = 3×6 cell array  [ 1] [] [] [31×31 do...

4 years ago | 1 answer | 0

1

Question

Good method to store pyramid shaped cell array?
Hi all, I need to store some matrices in a cell, say I have 4 matrices: e1, e2, e3, e4, I need to compute the product of the ...

4 years ago | 2 answers | 0

2

Question

Cellfun not working for cells contain cells?
Hi all, I have a cell like this K>> respCol respCol = 1×24 cell array Columns 1 through 5 {3×1 cell}...

4 years ago | 1 answer | 0

1

Question

Sum over cell array of sparse matrices error: Dimension for sparse matrix concatenation must be <= 2.
Hi all, I have a cell contains sparse matrices, K>> a a = 2×1 cell array [12×12 double] [12×12 do...

4 years ago | 1 answer | 0

1

Question

A function with 2 inputs, how to make it accept a 2-by-1 array as an input?
Hi all, There are some functions which accepts 2 inputs, such as inpolygon. For example: K>> xv xv = 1 ...

4 years ago | 1 answer | 0

1

Question

Function poly2cw not working?
Hi all, Matlab says: [x2, y2] = poly2cw(x1, y1) arranges the vertices in the polygonal contour (x1, y1) in clockwise or...

4 years ago | 1 answer | 0

1

Question

A function smart enough to sort coordinates of block into sub-blocks?
Hi all, Imagine there is a 2D shape made of randomly distributed square blocks, with Cartesian coordinates like this: <</m...

4 years ago | 1 answer | 0

1

Question

Group 3 * 3 (2d) or 3 * 3 * 3 (3d) coordinates into square blocks?
Hi all, This question might be quite complex. Imagine there is a 3D block like this with the Cartesian coordinates: <</mat...

4 years ago | 1 answer | 1

1

Question

How to combine multiple output from a function into 1?
Hi all, There are some functions in Matlab which gives multiple outputs, such as: K>> [x, y, z] = ndgrid(-1:0, -1:0, -1:...

4 years ago | 1 answer | 0

1

Question

Generate n-dimensional array: problem with 1D
Hi all, Imagine I'd like to generate random dimensional zeros matrix, I can do: K>> zeros(2, 2) ans = 0 ...

4 years ago | 1 answer | 0

1

Question

Dimensional problem in for loop.
Hi all, Imagine there is function which takes a matrix as input, perform some operations to each element, and gives an output...

4 years ago | 1 answer | 0

1

Question

How to index a matrix with existing array?
Hi all, Imagine there is a m by m matrix, I'd like to extract the [p, q] element, while [p, q] is the output of some calculat...

4 years ago | 2 answers | 0

2

Question

Sum over cell array of sparse matrices error: Dimension for sparse matrix concatenation must be <= 2.
Hi all, I have a cell contains sparse matrices, K>> a a = 2×1 cell array [12×12 double] [12×12 do...

4 years ago | 1 answer | 0

1

Question

How to find combination of random number of vectors?
Hi all, Function combvec gives the combination of n vectors. Imagine I have a cell C contains m vectors, how can I find combi...

4 years ago | 1 answer | 0

1

Question

How to change the double percent code section color?
Hi all, As we all know, %% indicates a code section in Matlab. When I put cursor on the section, the section background turns...

4 years ago | 1 answer | 0

1

Question

Is there a way to change default editor font and background color?

4 years ago | 1 answer | 0

1

Question

How to remove axis from a sparsity plot with spy function?
Hello, I plot the sparsity of a matrix with spy, like this: a = rand(5, 2); spy(a) So it comes with x and y axis, ...

4 years ago | 1 answer | 0

1

Is it possible to find connectivity of part of a FE mesh with only nodal information?
I solved it. Create an zero array where the indices represent the nodal numbers, set the nodal numbers of inclusions to 1. ...

4 years ago | 0

| accepted

Question

Is it possible to find connectivity of part of a FE mesh with only nodal information?
Hi all, Imagine there is a FE mesh with 2 inclusions: <</matlabcentral/answers/uploaded_files/89672/mesh.png>> I know th...

4 years ago | 1 answer | 0

1

Question

Structure mesh: plot different regions with different colors
Hi all, I have a 2D mesh with different regions, like this: <</matlabcentral/answers/uploaded_files/89152/CantileverBeam....

4 years ago | 1 answer | 0

1

Question

How to create readable files from Matlab to Paraview to display structural deformation?
Hello, I'm really new to Paraview, I'd like to create a plot in Paraview showing the displacement of a rectangular mesh. I u...

4 years ago | 1 answer | 0

1

Question

What's the truncation error in SVD?
Hi all, I'm trying to prove one thing: perform SVD on matrix a, the truncation error of singular values equals to truncation...

4 years ago | 1 answer | 0

1

Question

How to ensure text on plot always in front?
Hi all, I plot some surfaces and label some points on the surface with it's value of z-axis, as shown on the figure. You can ...

4 years ago | 1 answer | 0

1

Question

Multidimensional array: how to extract several dimensions at same time?
Hi all, Imagine there is a 4d array like this: arrayA = rand(5, 4, 3, 2); Now I need a new arrayB which contains all ...

4 years ago | 1 answer | 0

1

Question

Make Lagrange interpolation function faster?
Hi all, I coded a Lagrange interpolation function for matrices, and calls it in my main program. only 4 points linear interpo...

5 years ago | 0 answers | 0

0

Question

How to determine blocks in mesh grid?
Hello guys, I have a matrix representing a grid, say A = [-1 -1; -1 1; 1 -1; 1 1; -1 0; 0 -1; 0 0; 0 1; 1 0]; Every ...

5 years ago | 1 answer | 0