Answered
How do it rearrange the columns of a matrix?
A=[1 3 5 7 9;2 4 6 8 10] p=[2 4 5] ; q = setdiff(1:size(A,2),p) ; iwant = A(:,[p q]) ;

7 years ago | 1

Answered
Separating Data through the position of NaN
YOu can get the locations of NaN's using isnan. Once you have the indices of NaN's you can remove them. A = [1,NaN,NaN,2,3,4...

7 years ago | 0

| accepted

Answered
Find the exact multiple of a number by zero padding values.
A = rand(13848,1) ; n = length(A) ; % length of A r = 80 ; % to reshape by this dimension N = mod(-mod(n,r),r...

7 years ago | 0

Answered
How to display result from solve ?
iwant = double(S)

7 years ago | 1

| accepted

Answered
Pre-allocating a memory for a Matrix
iwant = zeros(1,200) ;

7 years ago | 1

Answered
Replace arrays of a matrix with a vector
Read about sub2ind. R=zeros(3); c=[1 1;3 2;1 2]; Newvalue=[ 3 7 9]; % get global indices idx = sub2ind(size(R),c(:,1),c(:,...

7 years ago | 0

| accepted

Answered
How to ask a user for an input for once ?
Put the prompt which asks for input outside the loop. prompt = 'Enter your function'; z = input(prompt); under = 0; nmax = ...

7 years ago | 0

| accepted

Answered
How to save a file in particular folder path?
Read here: https://in.mathworks.com/help/matlab/ref/movefile.html

7 years ago | 0

Answered
How to superimpose a matrix?
m = 5 ; k0 = [1 2 2 2 1] ; % diagonal elements k1 = -1*ones(1,m-1) ; % above and below main diagonal elements iwant = ...

7 years ago | 1

| accepted

Answered
How to index the value returned by a Map
YOu have to use u_est = values{2} ; For arrays the indexing is done using (), for cells indexing is done using {}.

7 years ago | 0

Answered
Plotting a Legend on a Graph
A = [0.0014,403.07, 0.00008875,403.07, 0.0014,662.18, 0.0007 ,662.18, 0.0014 ,878.11, 0.0007, 878.11, 0.0007 ,1122.83, 0....

7 years ago | 0

| accepted

Answered
Assigning values to variables "Method" and "Value"
%Approximating an Integral using multiple methods fprintf('%s | %s | %s | %s \n','N','Method','Value','abserror') a=0; b=2; ...

7 years ago | 0

Answered
For Loop /Array question
Check the below deom code where each element of a matrix is sum of its row and column position. Extend this to your case. m ...

7 years ago | 0

Answered
I need to create a 1x6 string combining strings?
Method 1: % Add space with the strings itself s1 = " I " ; s2 = " LOVE " ; s3 = " MATLAB " ; iwant = [s1,s2,s3] ; Metho...

7 years ago | 0

Answered
How to draw 3d graph for this given situation?.
You can use pcolor and surf. Read about them. x = 1:3 ; y = 1:4 ; A = rand(4,3) ; figure pcolor(x,y,A) figure surf(...

7 years ago | 0

| accepted

Answered
average vector over selected areas
A = randi([5 10],1,548); B= [1 102 105 204] % what i need to do x=mean(A(1:B(1)) ; x=mean(A(B(1):B(2)) iwant = zeros(length...

7 years ago | 0

Answered
Fit line on an edge of datapoints area
[c,h] = contourf(xaxis,yaxis,STABLE,[0 1]) ; The above gives you the points of the countour lines. SPlit them into two parts, ...

7 years ago | 0

Answered
Store values from for loop
names = cell(N,1) ; tags = cell(N,1) ; for i = 1:N % N is number of files % get names and tages names{i} = name...

7 years ago | 1

Answered
I have the equation: sin(x)=cos(2x^2), [0,2]
syms x ; eqn = sin(x)-cos(2*x^2)==0 ; sol = solve(eqn,x)

7 years ago | 0

| accepted

Answered
Closed-curve point offset
Try something like this. S is a Affine transformation matrix for scaling. % circle of radius 1 for demo th = linspace(0,2*...

7 years ago | 0

Answered
How to save automatic images/plots in High definition via a command
REad about imwrite

7 years ago | 0

| accepted

Answered
Help using sub functions
function Options=NV_hw2_4(volume,price) %goal here is to use the surface areas from the subfunctions and multiply them by the pr...

7 years ago | 1

| accepted

Answered
How to find cell positions of values within specific interquartile range from a column vector?
idx = find(A>V(1) & A<V(2)) ;

7 years ago | 1

| accepted

Answered
Plotting h(x) and v(x) function with user input of h0 and v0.
g=-9.81; h0=input('Enter the initial height in meters'); v0=input('Enter the initial velocity in meters/seconds'); %t=[1,2,3,...

7 years ago | 0

| accepted

Answered
how to plot two .m files on one graph
Remove figure from the second code....as you have used figure, it is opening a new figure. File2=csvread('secondhalf.CSV')...

7 years ago | 0

| accepted

Answered
Distribute randomly robots in the workspace
N = 16 ; d = reshape(randperm(N),4,4)

7 years ago | 0

Answered
Distribute randomly robots in the workspace
N = 16 ; d = reshape(randperm(N),4,4)

7 years ago | 0

Answered
missing data in surface plot
Your data is fine.....there are no missing values....you may try this: surf(x,y,Z) colorbar grid off shading interp ...

7 years ago | 0

Answered
Problem in find function???
[row,col] = find(A); First you will get rows and then columns .. Check: idx = find(A) ; [i,j] = ind2sub(size(A),idx) ; [...

7 years ago | 0

Answered
The figure is not showing after the plot is runned
Gsc = 1367; phi = 33; alpha = -117; figure(1) hold on for n = 1.0:1:366 delta(n) = 23.45*sind(360 * ((284+n)/365)); ...

7 years ago | 0

| accepted

Load more