Réponse apportée
Ellipsoid plot_ wireframe view
[Q,~] = qr(randn(3)); h = rand(3,1); h1 = h(1); h2 = h(2); h3 = h(3); % If your principal axis are (3x1) P1, P2, P3 and h...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How can I multiply two big matrices, avoiding out of memory?
You can process by chunk of smaller (100 here); % Generate small test data m = 100; n = 100^2; C = rand(m^2,3); % your [alph...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to sort a matrix's columns by using indexes
Short answer data = data(:,indA); Long answer load lung.mat data=lung; b = data(:,end) == 1; data1 = data(b,:); data2 ...

presque 7 ans il y a | 0

Réponse apportée
Switching an array of Vectors from Cartesian to Spherical Coordinates
OK since nobody care to give you the complete commands I'll [az,el,r] = cart2sph(V(1,:),V(2,:),V(3,:)); S = [az; el; r]; % <- ...

presque 7 ans il y a | 0

Réponse apportée
Minimum and maximum values of a field in a structure array
arrayfun(@(s) min(s.f1), s)

presque 7 ans il y a | 0

| A accepté

Réponse apportée
Row with means of each column in matrix
A = [A; mean(A,1)]

presque 7 ans il y a | 0

Réponse apportée
Matlab Gui Column Calculation Problems adds 48
Convert your GUI Data input using str2double, str2num etc >> str2double('0')+1 ans = 1 >> '0'+1 ans = 4...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
Sorting specific values of one matrix into another
Why not use Connected graph component?

presque 7 ans il y a | 0

Réponse apportée
How to get the longest consecutive values in a column vector and the position at which it starts
A=[0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1]' i=reshape(find(diff([0;A;0])~=0),2,[]); [lgtmax,jmax]=max(diff(i)); istart...

presque 7 ans il y a | 2

| A accepté

Réponse apportée
I want the code to randomize the rows and present each row for 10 times
The array B of the below has exactly 10 times each row of A in random order: m = size(A,1); B = A(mod(randperm(10*m),m)+1,:); ...

presque 7 ans il y a | 0

Réponse apportée
Generate matrix that is a product of its indices
n = 5; i = (1:n)'; j = 1:n; M = i.*j - (i+j)

presque 7 ans il y a | 1

| A accepté

Réponse apportée
permutations of a matrix
x = (1:5)'; n = size(x,1); m = 5; % size of b s = 3; % target sum(A(:)) [i,k] = ind2sub([m,n],nchoosek(1:m*n,s)); j = re...

presque 7 ans il y a | 1

Réponse apportée
how do I improve this code?
x = [2 5 6 7 8]; y = [1 3 4 8 9]; z = x.*y; z(10) = 0; c = cumsum(z);

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How to close the boundary of a surface already generated by filling the holes
Add the salt to suit your need Aorg = xlsread('Y_slice.xlsx'); gapmax = 5; % adjust to your need [m,n] = size(Aorg); A...

presque 7 ans il y a | 1

Réponse apportée
simple integration calculation to find the area ?
trapz(T,V)

presque 7 ans il y a | 0

| A accepté

Réponse apportée
determine combination of elements in matrix
lgt = 4; % number of elements nz = 2; % number of 0s j = nchoosek(1:lgt,lgt-nz); i = repmat((1:size(j,1))',[1 size(j...

presque 7 ans il y a | 0

Réponse apportée
Copy a figure to a subplot including all elements
close all fig1 = figure(1); ax = axes('parent',fig1); h=plot(ax,rand(1,10)); xlabel(ax,'x'); ylabel(ax,'y'); title(ax,'s...

presque 7 ans il y a | 4

Réponse apportée
Plot of an ellipsoid
% If your principal axis are (3x1) P1, P2, P3 and half length are (scalars) h1, h2, h3 Q = [P1(:), P2(:), P3(:)]; Q = Q .* ([...

presque 7 ans il y a | 0

Réponse apportée
Find the angle between two points in 3D plot.
if the 3D (x-y-z) coordinates of your two points are P1 and P2, both are (3 x 1) or (1 x 3) vectors angleradian = acos((P2(2)-P...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How do you chop a number to a specified number of significant digits, not round
2 digits fix(x*100)/100

presque 7 ans il y a | 2

Réponse apportée
Using maximum of optimisation variable as an upper bound for another variable
Not sure what you mean by "boundary condition" (there is no such thing in all optimization frameworks as far as I know), but tak...

presque 7 ans il y a | 0

Réponse apportée
Draw partial spheroid include a spheroid
The code bellow us this FEX to generate mesh points. % radius of the inner/outer spherical parts r1 = 1; r2 = 2; n = 20; %...

presque 7 ans il y a | 1

| A accepté

Réponse apportée
How to trim segments to fit a square
% Generate some test data, put 100 instead of 20 if you like X1=rand(20,1)*40; X2=rand(20,1)*40; Y1=rand(20,1)*60-10; Y2=r...

presque 7 ans il y a | 1

Réponse apportée
Create volume out of two surfaces
Tetra mesh generation. Let you do exportation in STL file % Points in xy-plane nx = 100; px = linspace(1,50,nx); pyi = 5+s...

presque 7 ans il y a | 0

| A accepté

Réponse apportée
pairs of consecutive numbers
A=[5 3 4 1]; As=sort(A); b=diff(As)==1; pairs=As(b)'+[0 1]; notpair = setdiff(A,pairs(:))

presque 7 ans il y a | 1

Réponse apportée
How can I rotate and reflect subplots as a group?
x = rand(5,9); y = rand(5,9); c = rand(5,9); close all % Normal figure for h=1:9 [m,n] = ind2sub([3 3],h); ...

presque 7 ans il y a | 0

Réponse apportée
how to add all 2d matrices in a 4D matrix???
sum(sum(A,3),4) or sum(A(:,:,:),3)

presque 7 ans il y a | 0

| A accepté

Réponse apportée
Calculation of unknown values of two equations without Symbolic Math toolbox
C = [1 1; -3 -2] \ [29; -70]

presque 7 ans il y a | 0

| A accepté

Réponse apportée
Multiplying 3D matrices
There is no stock function (what a MATRIX LABORATORY doesn't have such feature?), but here it is MTIMESX

presque 7 ans il y a | 0

| A accepté

Réponse apportée
How to round up components of a matrix to 1
>> A=[0.818655843258541 0.381356605388963 0.286089112378312 -0.0340005479718328 0.0773489731425248 -0.0465565535336793 -0.0390...

presque 7 ans il y a | 0

| A accepté

Charger plus