フィルターのクリア

I want to assign values from a 1d array to 2d array. How should I do it?

7 ビュー (過去 30 日間)
Ashutosh
Ashutosh 2013 年 8 月 21 日
Please copy paste above address if image is not visible.
The function tridiagonal(n) gives values of x in a 1 dimensional array. I want to assign it to 2 dimensional array of w(s,t). However it shows error saying "Undefined function 'x' for input arguments of type 'double'."

採用された回答

Jan
Jan 2013 年 8 月 21 日
編集済み: Jan 2013 年 8 月 21 日
You have not assigned a value to x. Maybe you meant:
for s=2:m
x = tridiagonal(n); % assign x!
for t=1:n
w(s,t)=x(t);
end
end
But you can save one of the for loops:
for s=2:m
x = tridiagonal(n); % assign x!
w(s, :) = x; % or x', depending on dimension of x
end

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 21 日
x is not defined in your code

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by