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

7年弱 前 | 1

| 採用済み

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

7年弱 前 | 0

| 採用済み

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

7年弱 前 | 0

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

7年弱 前 | 0

回答済み
Minimum and maximum values of a field in a structure array
arrayfun(@(s) min(s.f1), s)

7年弱 前 | 0

| 採用済み

回答済み
Row with means of each column in matrix
A = [A; mean(A,1)]

7年弱 前 | 0

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

7年弱 前 | 0

| 採用済み

回答済み
Sorting specific values of one matrix into another
Why not use Connected graph component?

7年弱 前 | 0

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

7年弱 前 | 2

| 採用済み

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

7年弱 前 | 0

回答済み
Generate matrix that is a product of its indices
n = 5; i = (1:n)'; j = 1:n; M = i.*j - (i+j)

7年弱 前 | 1

| 採用済み

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

7年弱 前 | 1

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

7年弱 前 | 1

| 採用済み

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

7年弱 前 | 1

回答済み
simple integration calculation to find the area ?
trapz(T,V)

7年弱 前 | 0

| 採用済み

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

7年弱 前 | 0

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

7年弱 前 | 4

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

7年弱 前 | 0

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

7年弱 前 | 1

| 採用済み

回答済み
How do you chop a number to a specified number of significant digits, not round
2 digits fix(x*100)/100

7年弱 前 | 2

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

7年弱 前 | 0

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

7年弱 前 | 1

| 採用済み

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

7年弱 前 | 1

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

7年弱 前 | 0

| 採用済み

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

7年弱 前 | 1

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

7年弱 前 | 0

回答済み
how to add all 2d matrices in a 4D matrix???
sum(sum(A,3),4) or sum(A(:,:,:),3)

7年弱 前 | 0

| 採用済み

回答済み
Calculation of unknown values of two equations without Symbolic Math toolbox
C = [1 1; -3 -2] \ [29; -70]

7年弱 前 | 0

| 採用済み

回答済み
Multiplying 3D matrices
There is no stock function (what a MATRIX LABORATORY doesn't have such feature?), but here it is MTIMESX

7年弱 前 | 0

| 採用済み

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

7年弱 前 | 0

| 採用済み

さらに読み込む