Answered
How to save variables into a matrix
count = 0 ; iwant = zeros([],3) ; % to store i,j,ortho(i,j) in respective columns sz = size(ortho); md= median(ortho); pk...

5 years ago | 0

| accepted

Answered
How to calculate sum without loop?
n = 1:100 ; s = sum(n.*cos(n/100))

5 years ago | 2

Answered
rotating a line using rotation matrix
L = rand(2,2) ; % line % Rotation matrix R = @(theta) [cos(theta) -sin(theta) ; sin(theta) cos(theta)] ; % Get mean m = ...

5 years ago | 1

| accepted

Answered
How can get roots of polynomial having variables in denominator.?
Read about vpasolve. syms x F = (x^2+1)/(x+1)+(2*x^2+3)/(x+2)==0 ; r = vpasolve(F)

5 years ago | 0

| accepted

Answered
Using or with strfind
position1 = strfind(str,p1) ; position2 = strfind(str,p2) ; OR position = strfind(str,[p1, p2]) ;

5 years ago | 0

Answered
generate random numbers between limits and satisfy condition
How about something like this? a = 5000 ; b = 6000 ; x = zeros(1,16) ; x(1) = randi([a b],1,1) ; for i = 2:16 x...

5 years ago | 0

Answered
How to solve Index out of bounds because numel(A)=4
This line: O = A(i)*E ; should be changed to: O = A*E

5 years ago | 1

| accepted

Answered
how to get the index from the plot for a specific condition
idx = myX>1200 ; % logical indexing myX(idx) idx = find(idx)

5 years ago | 0

| accepted

Answered
Help needed on this
You have to proceed something like below: x = -1:0.1:+1 ; y = -1:0.1:+1 ; [x,y] = meshgrid(x,y) ; U0 = 5 ; k = pi/4 ; L...

5 years ago | 0

| accepted

Answered
video of plot iterations in MATLAB
Proceed something like shown below: h = figure; axis tight manual % this ensures that getframe() returns a consistent size fi...

5 years ago | 0

Answered
How to Create a Multiplication Table in MATLAB Using while Loops
% Create 7 table n = 1:13; m = n.*7; table = [n;m] ; fprintf('7 x %d = %d \n',table)

5 years ago | 0

| accepted

Answered
help calling a function
You need to proceed something like shown below: function main() %Graphing position in free fall vs time(by 1 sec) %(in respec...

5 years ago | 1

| accepted

Answered
How do I read (hours) data from the .xlsx file?
Read about readtable. In here after reading your specify the format of time. Have a look on duration.

5 years ago | 0

Answered
I have error "Unrecognized function or variable 'X'" when calling computeCost(X, y, theta)
You are running a function, this is not the way to call a function. You need to define the variables first and then call the fun...

5 years ago | 0

Answered
How do I convert rows of strings to a timestamp?
Try: T.(1) = datetime(T.(1),'InputFormat','yyyy-MM-dd') ; % give your format here

5 years ago | 0

| accepted

Answered
Error using inline (line 51) Input must be a character vector.
s = input('Input the function interms of g(x)\n','s') ; Try using 's' in input, this will convert the entered value into a str...

5 years ago | 0

| accepted

Answered
How to join random curve segments to make a continuous entity from 2D array data
I assume you have multiple data's of lines and/or curves. I assume that each data (xi, yi) is a column array. First merge them i...

5 years ago | 1

Answered
Checking for corrupted JPEG files
You may capture the warning and skip the processing, if you get warning. Refer on how to capture the warning. https://undocume...

5 years ago | 1

| accepted

Answered
Array computation in Matlab
Check the below example: theta = [0 30 45 60 90 180] ; % angle in degrees y = sind(theta)

5 years ago | 0

Answered
Marking multiple points on a plot manually with the mouse and saving those points and extracting them
You can use this: https://in.mathworks.com/matlabcentral/fileexchange/7173-grabit

5 years ago | 0

Answered
how to stop overwriting a matrix in a for loop in matlab
M = zeros([],[],100) ; % give exact row and column size for n =1:100 y = OUT.lin.matin(:,:,n); %ge...

5 years ago | 0

| accepted

Answered
How to plot the variations of the maximum and minimum on 2 separate diagrams
Read about the function stem x = rand(1,10) ; [val1,idx1] = min(x) ; [val2,idx2] = max(x) ; stem([idx1 idx2],[val1 val2])...

5 years ago | 0

Answered
How to change a given name
Also read about strcat. %% test num = '0000060' folder = ['C:\Users\dit\Documents\MATLAB\RawData\',num,'.csv']

5 years ago | 1

| accepted

Answered
How to display the Index of a matrix to other corresponding matrices
[val,idx] = min(A(:)) B(idx) C(idx)

5 years ago | 0

Answered
smoothing 2D scattered points
Read about polyfit.

5 years ago | 0

Answered
Array size decreases with every iteration
You need to read about circshift.

5 years ago | 0

Answered
How to mirror pad a matrix
Let A be your given matrix of size 8*8 and vec be your vector which has to be padded and of size 1*8; iwant = ones(10) ; iwa...

5 years ago | 1

Answered
Undefined function 'eq' for input arguments of type 'cell'. Undefined function 'gt' for input arguments of type 'cell'
There is no eq, gt in MATLAB; instead of that you need to use ==, >. Example: A = rand(10) ; B = rand(10) ; idx1 = A == B ...

5 years ago | 0

Answered
Grouping data by value
Let x be your data. Create arespective y-value which denotes grouping. y = zeros(size(x)) ; % get values -1.00 to -1.49 id...

5 years ago | 0

| accepted

Answered
How do you write a program that gives the current time and day?
d = datetime('now') ; fprintf('The current date is %s\n', d);

5 years ago | 0

| accepted

Load more