How to allocate variables

2 ビュー (過去 30 日間)
Triveni
Triveni 2015 年 6 月 26 日
編集済み: Stephen23 2019 年 6 月 25 日
I have 20 values of L
L =
1.0e-04 *
0.1215 0 0
0.1215 0 0
-0.1285 0 0
L =
1.0e-04 *
0.1215 0 0
0.1215 0 0
-0.1285 0 0
L =
1.0e-04 *
0.1215 0 0
0.1215 0 0
-0.1285 0 0
L =
1.0e-04 *
0.1215 0 0
0.1215 0 0
-0.1285 0 0
L =
.... ETC
I have to allocate Name L(1), L(2), L(3), L(4).........L(N). How can i allocate ...please tell me procedure or command
  2 件のコメント
Triveni
Triveni 2015 年 6 月 27 日
Allocate means each value of L to L1, L2............... i have to take these value to next program.

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

採用された回答

Thorsten
Thorsten 2015 年 6 月 29 日
Assuming that your L is a matrix, you simply store the ith L as
allL(:,:,i) = L;
To make the code more efficient, you can allocate allL before the loop
n = 3; % number of rows of L
m = 3; % number of columns of L
N = 20; % number of L's
allL = nans(n,m,N);
for i = 1:N
%compute the ith L
L = ...
allL(:,:,i) = L;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by