New to matlab, trying to understand basic functions still

조회 수: 4 (최근 30일)
Kayla
Kayla 2023년 11월 2일
답변: John D'Errico 2023년 11월 2일
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일
편집: 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