Answered
What is the meaning of the Error Mesage "Subscript indices must either be real positive integers or logicals."
In MATLAB the indices of an array always should be positive integers. The indices can be 0,1 if it is og logical type. Example...

6 years ago | 1

| accepted

Answered
coordinates from in the image
Read about ginput, getpts. You can get the points by clocking with mouse, the points you get will be w.r.t to the indices/ dimen...

6 years ago | 0

Answered
replace [ ] in an array with 0's
You run on each column of a table..

6 years ago | 0

Answered
How to get the sum of the series: 1 + 1/2 + 1/3 + 1/4 + ... + 1/n?
n = 10^5 ; s = 0 ; i = 0 ; while s <= 3 % fix the sum here i = i+1 ; s = s+1/i ; end i

6 years ago | 0

Answered
replace [ ] in an array with 0's
You can get all the emtpy functions in a cell using cellfun .. idx = cellfun(@isempty,C) ; % get empty cells in a cell array C ...

6 years ago | 1

Answered
transform a matrix with polar coordinates into a matrix with cartesian coordinates
Read about pol2cart. https://in.mathworks.com/help/matlab/ref/pol2cart.html

6 years ago | 1

Answered
creating combinations in the rows of two large multi-dimensional (N-by-M) matrices
Read about nchoosek, combnk. combnk will give you indices, and using these indices you can pick the rows.

6 years ago | 0

Answered
How to find radius of curvature?
https://in.mathworks.com/matlabcentral/fileexchange/69452-curvature-of-a-2d-or-3d-curve

6 years ago | 1

Answered
Merge specific text files
% to read files starting with M1 txtFiles = dir("M1*.txt") ; N = length(txtFiles) ; A = zeros(N,4) ; for i = 1:N a =...

6 years ago | 0

Answered
Current carrying Capability Program
The problem is very simple and straight forward. If I have a formula d = a*b/c with a, b, c defined to evaluate d, we do: a =...

6 years ago | 0

Answered
What is the equivalent to MATHCAD's Given-Find
You can try this: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function

6 years ago | 0

Answered
Plotting a an equation as function of radius .
t = linspace(pi/2,3*pi/2) ; k = 10 ; r0 = 1000 ; r = r0*exp(t/k) ; % on solving the give equation for r plot(t,r)

6 years ago | 0

Answered
Count number of values within a range in tall array per column and assign count to new matrix
You can achieve this using histogram. Read about histcounts.

6 years ago | 1

Answered
diameter of image (1024x1024 logical value)
Let A be your logical of 1024*1024 [y,x] = find(A) ; % get all th points with 1 C = [mean(x) mean(y)] ; % this gives ...

6 years ago | 1

Answered
Order of filenames is wrong
Use this fileexchange function: https://in.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort

6 years ago | 1

Answered
Plotting with gaps in x-axis data
It looks like you have a non continuous x-axis data. This problem occurs when you have such data and try to plot. Make x-axis ...

6 years ago | 0

Answered
write a matlab code that generate a random number, then divide the generated number by 4 if its even number and greater than 100.
To generate randomnumber read about randi. To check whether even or not use mod. Read about mod. To check whether greater or...

6 years ago | 0

Answered
A year containing a date or not
Read about the function calendar. https://in.mathworks.com/help/matlab/ref/calendar.html Fromhere you can pick the required co...

6 years ago | 0

Answered
i have a variable in my workspace and i dont know its name directly
If you have variables in the workspace....to get the variable names use: S = whose ; names = {S.name} ; Use strcmp to find ...

6 years ago | 0

Answered
How to plot fft outputs in frequency domain?
You read here....https://in.mathworks.com/help/matlab/ref/fft.html You have to generate the frequency values based on the sampl...

6 years ago | 1

| accepted

Answered
How to generate one random integer
As you cannot fix infinity, decide a huge/large number ..say 10^5 and use: x = randi([-10^5 10^5],1)

6 years ago | 2

| accepted

Answered
How to calculate the derivative and deviation of a series of data
To find deviation i.e standard deviation use std. To find derivative ..if you have time step use... d = diff(data)/dt ; Alo...

6 years ago | 0

Answered
How to run a code several times using a for loop
Make your given code into a function with input and output. Output should be your required matrices/ data. Make output into ...

6 years ago | 0

Answered
K means image clustering with time series data
Let x be your 1D data. Assuming it column vector. t = 1:length(x); t = t'; idx = kmeans([t x],3);

6 years ago | 0

| accepted

Answered
How do I take the 'left' side of a matrix? (row-wise)
For your first example: b = a(:,1:3) ; If A is your matrix..if your first first n columns B = A(:,1:n) ; If you want fir...

6 years ago | 0

Answered
Making a matrix act like a coordinate plane
x = -50:50 ; y = -50:50 ; [X,Y] = meshgrid(x,y) ;

6 years ago | 0

| accepted

Answered
get indices where the value is 0
Let A be your vector....to get indices of zero use... idx = find(A==0) ; % gives indices directly idx_l = A==0 ; % gives...

6 years ago | 0

Answered
Two different ways of using iterations
In the first case, you are not saving the result. Check the below. load tal v_stor=zeros(1,length(V)); v_liten=zeros(1,lengt...

6 years ago | 1

Answered
How to store vector in a loop and print into excel file all at once?
You are wrtitng R in the xlswrite command. Replace R with Es. L = length(y_train_corr(1,:)); R = corrcoef(y_train_corr(:,2),y_...

6 years ago | 1

| accepted

Load more