sum different cell arrays based on index
A = { [0,1,0], [1,0,0], [0,0,0], [0,0,0], [0,0,1], [1,1,0], [0,0,0]} ; id = { [1,2,3], [4,5,6] } ; n = length(id) ; iwant...

3日 前 | 0

| 採用済み

Embed vector field in bigger array

3日 前 | 0

| 採用済み

How to find function for many parameters?
vals = [1, 2,3 6,1,4 7,3,5] ; [m,n] =size(vals) ; B = zeros(4,4,m) ; for i = 1:m B(:,:,i)=fun(A,vals(i,1),vals(i,2...

4日 前 | 1

| 採用済み

How to Copy Upper diagonal elements of matrix A into a new matrix.
You need to proceed like this: for i = 1:m for j = 1:n if i <= j end end end

4日 前 | 0

How to set level values of a variable by comparing(subtracing) two nc files
Your interpolation grid coordinates are completely different comapred to original grid. Read about interp2. ncfile_1 = 'A20150...

4日 前 | 0

| 採用済み

How to match the origins of two different length vectors and pad zeros to match their length?
You must be having (t1,x1) and (t2,x2) ; these are two singlas. You can pick the superset time out of (t1,t2). For the other f...

4日 前 | 0

Error using axis>LocSetLimits (line 325) Vector must have 4, 6, or 8 elements. Error in axis (line 113) LocSetLimits(ax(j),cur_arg,names);
Read about axis. As yours is a 2D plot you need to input four values, which correspond to minx, maxx and miny, maxy. axis([0 b...

4日 前 | 0

| 採用済み

The Piggy Bank Problem
Given a cylindrical piggy bank with radius g and height y, return the bank's volume. [ g is first input argument.] Bonus though...

4日 前

I want this two stl files to overlap each other
Do both the stl files have same number of nodal connectivities and nodes? If so you can subtract them. If not you can make your ...

4日 前 | 0

| 採用済み

How select data just out from a polygon, considering a constraint
Read about knnsearch. This will give you indices of points lying closer to the given set of points from a set of points along wi...

4日 前 | 0

How to display image from 2d matrix?
Let A be your matrix. figure imshow(A) figure imagesc(A) figure pcolor(A) ; shading interp; colorbar

6日 前 | 0

| 採用済み

Create a surface from several 1D plots
See to it that all the curves have same dimensions. If not use interp1 and get them into same size. Initliaze matrices X, Y, Z...

9日 前 | 0

Divided a matrix into sub-matrices (MATLAB)
H=zeros(m,n) ; J = 3 ; K = 6 ; H(:,J) = 1 ; H(K,:) = 1 ;

9日 前 | 0

Turning a column to months into number equivalent
Read about findgroups. https://in.mathworks.com/help/matlab/ref/findgroups.html a = {'Apr', 'Jan','Feb', 'Apr', 'Jan'} ; iwant...

9日 前 | 1

| 採用済み

Reducing the size of images by a loop
imgNames = dir('*.png') ; % give your exntenion of images in the folder N = length(imgNames) ; % toal number of images ...

9日 前 | 0

| 採用済み

Find a range in a matrix and rescale it
Let A be your image: A0 = A ; % save for test idx = A >= 120 & A<= 230 ; % get indices of required values val = A(idx) ;...

9日 前 | 1

| 採用済み

How to shift a cell in a matrix by desired number?

9日 前 | 1

Calculate running hold duration

10日 前 | 0

| 採用済み

plot and then plot the same graph with filled area
x = linspace(0,2*pi) ; w = @(x) x.*exp(-x).*cos(x) ; y = w(x) ; figure plot(x ,y) figure; area(x,y)

10日 前 | 0

sphere coordinates using latitude and longitude system
r = 1; % Radius 1 km xo = 0; yo = 0; zo = 0; %Center, give points of A m = 20; n = 10; theta=0:2*pi/m:2*pi ; phi=-pi/2...

10日 前 | 0

Average or sum specific-non-sequential columns
Let A be your 100x10 matrix. You can remove the said columns from he matrix and use the functions to get what you want. idx = ...

10日 前 | 0

| 採用済み

How do I print out a sequence of numbers on a text file using fprintf??
fid = fopen('test.txt','w') ; fprintf(fid,'%s %s %s\n','Imaage Number','centx','centy') ; n = 10 ; for i = 1:n fprintf...

10日 前 | 0

Issue in plotting of output after function
function myfun() syms theta A = cos(theta).*[1 5 6; 2 9 3; 5 1 0]; B = tan(2*theta).*[8 5 1; 0 1 6; 2 4 7]; myfun = @(t,y)sc...

10日 前 | 0

| 採用済み

How to plot XRD data as 3D plot?

10日 前 | 1

What's the quickest way to find frequency of a signal?

10日 前 | 0

Selection data with percentage
X = rand(1,100) ; % say your data or units n = length(X) ; % move in the order A = X(1:60/100*n) ; B = X(60*n/100+1:end...

10日 前 | 1

How to set a new default linewidth for stem plots
x = rand(1,5) ; h = stem(x) ; h.LineWidth h.LineWidth = 2 ;

10日 前 | 0

The input which you are using i.e. options should be a structure with fields ProblemSize PopulationSize minPosition maxPos...

10日 前 | 0

Extract consecutive data points between 2 thresholds
Let t be your dates in datetime format and w be your wind data. % get indices of wind lying in [20, 30] idx = w>= 20 & w <= 3...

11日 前 | 0

How to find an area inside of the curve?