已回答
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 前 | 0

| 已接受

已回答
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 前 | 0

已回答
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 前 | 0

| 已接受

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

2 years 前 | 0

已回答
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 前 | 2

已回答
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 前 | 0

已回答
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 前 | 1

已回答
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 前 | 0

| 已接受

已回答
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 前 | 0

| 已接受

已回答
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 前 | 1

| 已接受

已回答
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 前 | 0

| 已接受

已回答
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 前 | 0

已回答
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 前 | 0

| 已接受

已回答
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 前 | 1

已回答
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 前 | 0

已回答
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 前 | 0

| 已接受

已回答
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 前 | 0

已回答
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 前 | 0

已回答
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 前 | 1

已回答
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 前 | 0

| 已接受

已回答
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 前 | 0

| 已接受

已回答
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 前 | 0

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

2 years 前 | 0

| 已接受

已回答
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 前 | 0

已回答
Write a function that takes a number to be guessed and a player number, and checks if the winning criteria is met.
trying to find out the nearest minimum and maximum value userguess=[2 5 10 17 19]; gamenum=13; y=NumberGuess(gamenum,usergues...

2 years 前 | 0

已回答
MATLAB CODE FOR PLOTTING WON'T DISPLAY A LINE
try this: x=[0:0.002:2]; R=0.12; betta=2.623; H=0.2; K=0.5; y=(R.*(H.*x.^2.*betta.^2-betta.*x+x.*betta.*(2-H.*betta.*x)))/...

2 years 前 | 0

| 已接受

已回答
Plot a histogram from given data.
try this: B = readtable('hw3.txt','ReadVariableName',false,'delimiter',':'); data2=B(:,2); data3=table2array(B(:,2)); data4=...

2 years 前 | 1

已回答
I want to know how to multiply array elements one by one.
A=[1 2; 3 4]; B1=A(1,1)*A(:); B2=A(1,2)*A(:); B3=A(2,1)*A(:); B4=A(2,2)*A(:); matrix=[B1 B2 B3 B4]; out=reshape(matrix,1,[...

2 years 前 | 0

已回答
How can we randomly assign the number we want to the machines that write 1 in the 1-0 matrix?
after for loop, try this y=population; y(y==1)=randi([2 10],1,1)

2 years 前 | 0

| 已接受

已回答
The code works but the 1st column shows NaN and 3 numeric data is missing.
try this: data = readtable('hw3.txt','ReadVariableName',false,'delimiter',':'); data2=table2array(ata(:,2)) data3=split(data3...

2 years 前 | 1

加载更多