フィルターのクリア

How to read matrix into a variable increment?

3 ビュー (過去 30 日間)
MAIZATUL
MAIZATUL 2013 年 5 月 29 日
I have a matrix A that only have data on 1st column.
How can I write this matrix as increment
t = [0:1st row data :end of row data]
help, thank you.

回答 (2 件)

David Sanchez
David Sanchez 2013 年 5 月 29 日
Your question is not clear. Do you mean something like this?
A=zeros(10);
A(:,1)=rand(10,1);
B=sort(A);
Where B contains the data in A order from minimum value to maximum.
If you want to write that column in incremental form, such as
t=1:2:20
t =
1 3 5 7 9 11 13 15 17 19
You need the first and last term and the increment between each value, supposed to be constant, otherwise you can't do as you want. You can not write in incremental notation an array like
c = [1 3 4 8 17 19 23 58]
since the increment between any two consecutive terms is different from any other
  1 件のコメント
MAIZATUL
MAIZATUL 2013 年 5 月 29 日
my data in matrix is not constant increment. so it cant be done

サインインしてコメントする。


Muruganandham Subramanian
Muruganandham Subramanian 2013 年 5 月 29 日
e.g,
>> A=[1;2;3;4;5;6];
>> t = 0 : A(1,1) : A(end,1)
Are you expecting like this??
  3 件のコメント
Muruganandham Subramanian
Muruganandham Subramanian 2013 年 5 月 29 日
編集済み: Muruganandham Subramanian 2013 年 5 月 29 日
Is your A matrix will change randomly from time to time ?? Show ur code then?
if its having random data like below, e.g
>> A = [ 4; 2; 7; 90; 1; 34; 6; 34; 23;];
then
>> t = 0 : A(1,1): A(1,1) * size(A,1);
Try this
MAIZATUL
MAIZATUL 2013 年 5 月 29 日
its ok I solved it. A = [2.345, 4.543, 5.676... end}
t = [A(1:end)] thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by