Answered
how to apply if statement with equations
you have only 2 conditions. greater/equal to 0 or less than 0. so try to use if-else function, not if-elseif. Cm2 = [80.105 81....

2 years ago | 0

Answered
How to replace the trapped zeros by previous number in a given matrices keeping leading and trailing zeros fixed?
try this: A=[ 0 0 0 1 0 2 3 1 2 3 0 0 0 1 2 2 1 1 2 ...

2 years ago | 0

| accepted

Answered
How to use nested loop to produce the row and columns like that
you did not clear your expection. you can try this A = [2,4,8,7,3;2,2,3,4,3;5,5,4,2,7;8,2,7,3,9;1,2,3,4,5]; rows = size(A,1); ...

2 years ago | 0

Answered
How can I take the element of odd rows of an array (n rows, 1 column) and make a variable with all this elements?
you don't need a loop A=(1:20)'; oddrow=A(1:2:end)

2 years ago | 0

| accepted

Answered
How to I find x in sin(x) = 0.65
a=sind(30) x=asind(0.5) %Inverse sine in degrees

2 years ago | 0

Answered
how to shift trapped zeros to the bottom keeping leading zeros in given matrix fixed?
if your matrix A almost same dimension( 5 X 13) everytime, then A = [0 0 0 1 0 2 3 1 2 3 0 0 0; 1 2 2 1 1 2 3 1 2 3 1 3 4; 0...

2 years ago | 2

Solved


Y=X
Given an input variable x, output a variable y that is equal in value to x. Example: Input x = 1 Output y is 1 Inp...

2 years ago

Solved


03 - Matrix Variables 6
Make _fMat_ be a 5x3 matrix of random integers with values from -3 to 3 (Hint: use *randi*)

2 years ago

Solved


07 - Common functions and indexing 4
Define the matrix _cMat_: <<http://samle.dk/STTBDP/Assignment1_3c.png>> ( _cMat_ = 10x10 matrix where the numbers from 1 t...

2 years ago

Solved


Getting logical indexes
This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

2 years ago

Solved


Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

2 years ago

Answered
How to check if all the data in the cell array are the same?
if you want to find every index for true or false A={100}; B=repmat(A,1,10); [Lia Locb]=ismember(string(B),string({100}))

2 years ago | 0

Answered
Rearrange a given array
A=[1 2 3 4 5 6 7 8 9 10 11 12]; B=flip(A) % flip out=reshape(B,3,4) % row number=3 and column number=4

2 years ago | 1

Answered
How to find when the maximum occurs
time=(1:5)'; val1=[10 13 45 23 11]'; val2=[56 23 45 89 23]'; val3=[90 78 12 45 22]'; matrix=[time val1 val2 val3] [M I]=max...

2 years ago | 0

| accepted

Answered
Updating matlab table using the closest match in a different table.
try this: time1 = [1;2;3]; time2 = [2.1; 1.2; 3.4]; x = [3; 4; 5]; id = [1;2;3]; T1 = table(time1,id); T2 = table(time2,x)...

2 years ago | 0

| accepted

Answered
reads in n numbers from the user,storing the numbers in a vector, then print the numbers from the ends inwards(last,first,second last,second)
try this: numbers = input('How many numbers will you enter: '); % create a empty vector to store the numbers n = []; Opsetnu...

2 years ago | 1

| accepted

Answered
Create the x axis to my need
try this: y = transpose((0:1:49)); xaxis = transpose(1:0.5:length(y)/2+1/2); plot(xaxis,y)

2 years ago | 0

| accepted

Answered
Intersect - extraction of row data based on matched results
date1=[44562.00;44563.00;44564.00]; date2=[44562.00;44564.00]; a={'t1';'t2';'t3'}; b=[1;1;1]; c=[2;3;4]; T1=table(a,b,c); ...

2 years ago | 0

Answered
Import txt. files from a folder for training data
if you want to import all the text files,try this textfiles = dir('*.txt'); numfiles = length(textfiles); mydata = cell(1, n...

2 years ago | 0

| accepted

Answered
convert code to function
try this % call your function a =[1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1...

2 years ago | 1

Answered
How to attach multiple matrices to a single matrix?
A = [1,2,3,4,5,6,7,8,9,10]; B = {'a','b','c','d','e','f','g','h','i','j'}; C = [11,22,33,44,55,66,77,88,99,100]; D = {'A','B'...

2 years ago | 0

Answered
Write nested cell array data into separate excel sheets
try this: A=load('Data3.mat'); B=A.Tc ; firstrow=[B{1,:}]; % C=string(firstrow); writecell(firstrow,'filename1.xlsx') sec...

2 years ago | 0

| accepted

Answered
Why does this loop return the same value for the variable each time?
try this: A=load('Temp_F.mat'); temp_status=[]; Temp_F=A.Temp_F; x=diff(Temp_F); z=conv(x,ones(300,1)); figure() y=plot(z...

2 years ago | 0

Answered
Creating a datetime variable - unconventionally
try this: B=readtable('Data-E.xlsx'); C=B(1:48:end,:); dat=string(table2cell(C(:,1))); date = datetime(dat, 'InputFormat','y...

2 years ago | 0

Answered
Creating a datetime variable - unconventionally
As you did not attach your data. let's try with your first data A='200301'; date=datetime(A,'InputFormat','yyyymm'); date2=da...

2 years ago | 1

Answered
I need assistance with a MATLAB myMakeSize question
x=1:5; out=myMakeSize10(x) % function y = myMakeSize10 (x) if numel(x)>=10 y=x(1:10); elseif numel(x)<10 y=[x zeros...

2 years ago | 0

| accepted

Answered
Write Data to txt file from Excel
try this: A=readtable('data.xlsx','ReadvariableName',false); writetable(A,'myfile.txt') or B=readmatrix('data.xlsx'); write...

2 years ago | 0

| accepted

Answered
Trying to implement the aircraft model in Matlab
i am not so clear about your expectation. my guess A=load('u1.mat'); u1=A.u1; u1min = -25*pi/180; u1max = 25*pi/180; u2min...

2 years ago | 0

Answered
how to Select a particular column with maximum values?
try this: A=randi(100,10,5) output=max(A,[],2)

2 years ago | 0

| accepted

Answered
What is the meaning of symbol “.”in this code
It's element wise operation. you can read this https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.htm...

2 years ago | 0

Load more