how to print column values into column 1

1 回表示 (過去 30 日間)
andrew
andrew 2013 年 7 月 26 日
I am trying to print a column that is 281x1 matrix and I keep getting an error message saying that the index exceeds the dimensions
below is the code. size of A is 3157x1 matrix
[nRows,~] = size (A);
samp=cell(nRows,13);
for n=1:nRows
samp{n,1}=newfile2{n};
samp{n,9}=A{n};
end
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 26 日
What is the size of newfile2?

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

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 26 日
If the size of newfile2 is correct, there is no error in your code
A=num2cell(rand(5,20,1))
newfile2=num2cell(randi(5,20,1))
nRows = size (A,1);
samp=cell(nRows,13);
for n=1:nRows
samp{n,1}=newfile2{n};
samp{n,9}=A{n};
end

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by