New to matlab, trying to understand basic functions still

4 次查看(过去 30 天)
Hello! I am new to matlab and I am working with some data, however, I am trying to understand what it means with the following (hopefully this makes sense):
x= D0a(:,1); nf=length(x);
y=(1:9)'; ns= length(y);
D0a is the element.

采纳的回答

Sulaymon Eshkabilov
编辑:Sulaymon Eshkabilov 2023-11-2
The meaning of these entries are:
x= D0a(:,1); % The existing variable D0a's column 1 is assigned to a new variable called x
nf=length(x); % Counting the length of x (vector)
y=(1:9)'; % Creating y vector, transposing 1 to 9 (row vector) into 1:9 column vector
ns= length(y); % Counting the length of y (vector)
% to get help on any of MATLAB functions use: help
help length
help transpose
% Advice: study MATLAB Onramp

更多回答(2 个)

the cyclist
the cyclist 2023-11-2
Assuming that D0a is a matrix, then
  • x is the 1st column of that matrix. (x is a column vector.)
  • nf is the number of elements in that vector x.
  • y is the vector [1 2 3 4 5 6 7 8 9], but then transposed to be a column vector, rather than a row vector.
  • ns is the number of elements in that vector y.
You are right that these are very basic questions. I strongly suggest you invest a couple hours in viewing the free MATLAB Onramp online tutorial.

John D'Errico
John D'Errico 2023-11-2
If you are this new to MATLAB, then you seriously need to spend some tie reading the tutorials available.
The MATLAB Onramp is a good place to start. But there are also many other things you can read. Why not read the manual? Yes, I know, you don't need no steenkin' mauals. Spend a couple of hours. It will pay dividends.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by