Answered
Digits that repeat in an n by m matrix
A = [ 9 5 2 1 5 3 3]; x = unique(A); N = numel(x); count = zeros(N,1); for k = 1:N count(k) = s...

4 years ago | 0

Answered
How I can load multiple data files in workspace?
files = dir('Data*') ; % you are in the folder of data files N = length(files) ; iwant = cell(N,1) ; for i = 1:N iwa...

4 years ago | 0

| accepted

Answered
How to add sparse matrix to an n*n matrix
To add A and B, they should be of same dimension. In your case A is 4x4 matrix whereas B is not. So to add them, you have to mak...

4 years ago | 0

| accepted

Answered
Stacking diagonal matrices generated from rows of other matrix
This would be better than given code: C=magic(4) ; D=zeros(3,3,4); for i=1:4 D(:,:,i)=diag(C(i,2:4)); end D = re...

4 years ago | 0

Answered
Locate indices of datetime from one table in another?
Read about ismember, ismembertol.

4 years ago | 0

Answered
how to save scatter plot of each row as image for image classification
load('saveddata.mat') ; for i = 1:100 plot(fixedclass(i,:),'.') drawnow filename = [num2str(fixedclass(i,1)),'.p...

4 years ago | 0

Answered
Number of observations in X and Y disagree.
Your yc i.e. target for the respective input in the line: net1 = trainNetwork(GlucoseReadingsTrain,yc,layers,opts); is of dime...

4 years ago | 0

| accepted

Answered
How do I do part 2 and 3 here?
Velocity is nothing but dr/dt i.e. slope. So you have used polyfit and you got the slope already.

4 years ago | 1

Answered
repeat in the same vector
v = [1 2 3; 4 5 6] ; iwant = repmat(v,1,2)

4 years ago | 0

Answered
How to display R, G, B colours of an individual pixel in an image?
MAke/ create the required coordinates/ locations where you want to put text and the use patch, text. Read about patch and text...

4 years ago | 0

Answered
Vandermonde-like matrix
p = -(0:0.5:4) ; % power values n = 5 ; % n value ind1 = bsxfun(@plus, (1 : n), (0 : numel(p) - n).'); % make moving win...

4 years ago | 0

| accepted

Answered
Randomly generate a 10x10 matrix. Using a command string, extract a 5x5 array containing the elements at the bottom right of the original array.
Read about rand and matlab matrix indexing. https://in.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.ht...

4 years ago | 1

| accepted

Answered
The OR statement "|" is not working
You may consider replacing the line roll ~= 2 | 3 | 7 | 11 | 12 with ~ismember(roll,[2 3 7 11 12])

4 years ago | 1

Answered
How to pick only one non-zero value from each row of a matrix (iterative output)
A = readmatrix('R_mean_value_0.01.csv'); m = length(A) ; IG = [0, 10, 100, 1000] ; % initial guess n = length(IG) ; nn ...

4 years ago | 0

| accepted

Answered
How do I make a cell array of doubles with non-uniform dimensions into a matlab array? (substitution of blanks with NaN or Zero)
L = cellfun(@length,output) ; iwant = NaN(length(L),max(L)) ; for i = 1:length(L) iwant(i,1:L(i)) = output{i} ; end Bu...

4 years ago | 1

Answered
Converting Numeric Dates in Matlab does not work
table1.Date = datestr(table1.Date) Or table1.Date = datetime(datevec(table1.Date))

4 years ago | 0

| accepted

Answered
if i have 4x3 matrix all values equal 1 , how to change the diagonals to zeros ?
A = ones(4,3) ; A(1:1+size(A,1):end) = 0

4 years ago | 1

Answered
Create STL from patch object or simlar
load('Contours.mat') ; p = [perimeter1 ; perimeter2 ; perimeter3 ; perimeter4 ; perimeter5 ; perimeter6 ; perimeter7 ; perime...

4 years ago | 0

Answered
Vertcat with equally sized tables does not work
Try join. table_3 = join(table_1 , table_2)

4 years ago | 0

| accepted

Answered
when the result of strmatch has no value, then how can I change it to 0?
REad about contains. You may use them. Also have a look on strcmp.

4 years ago | 0

| accepted

Answered
how would i write script to graph the 't' and 'y' values?
Read about plot function. plot(t,y); xlabel('t') ylabel('y')

4 years ago | 0

Answered
How to solve second-degree algebraic equation containing elements of struct arrays?
syms k1 k2 k3 eqn = k1 * cos(ell1.theta)^2 + 2*k2 * cos(ell1.theta)^2 + k3 S = solve(eqn)

4 years ago | 1

| accepted

Answered
How to split a column with numerical values?
load('data.mat') name = reshape(struct2array(ICCs),3,[])' ; T = array2table(name); Or you can use load('data.mat') T = stru...

4 years ago | 0

Answered
'Index exceeds the number of array elements ' why this error is showing?
This line: dydt = [y(4) (-ugdd-(2*r1*w1*y(4))-((w1)^2*y(3)))]; expects y to be 1x4 vector, but your y is 1x2.

4 years ago | 2

Answered
How to use subplot in a loop?
for i = 1:9 subplot(3,3,i) end

4 years ago | 0

| accepted

Answered
How to plot a vector?
Read about quiver x = 0 ; y = 0; u = 0; v = 0 ; quiver(x,y,u,v)

4 years ago | 0

Answered
How to combine two exponential equations into one?
And I would like y to be multiplied from row 1-2112 and y2 to be multipled from row 2113-4224 Yes, it is possible. Let dataCorr...

4 years ago | 0

Answered
How to add 5% uniformly distributed Noise in the dataset
load('datasetvalue.mat') [rows, columns] = size(dataset); N = zeros(rows,columns) ; % pick 5% of random indices idx = ran...

4 years ago | 0

Answered
How to replace value with zero to match the size of array
Let A be your 250x1000 array. B = zeros(size(A)) ; % initialize the zero matrix B(:,1:20) = A(:,1:20) ; % replace first twent...

4 years ago | 0

| accepted

Answered
How to import kmz file or import a google earth gui in matlab?
https://in.mathworks.com/matlabcentral/fileexchange/12954-google-earth-toolbox

4 years ago | 0

Load more