- #1
ChristinaJ
Gold Member
- 35
- 1
Hi all,
I have the following code which runs without error but gives no output. It's probably simple but I just can't see the problem.
LM={};
M[line_, cur_, lq_, ld_, k_] := For [i = 1, Length[line[[1]]], i++,
Module[{m}, If[line[[1, i]] == "Q",
m = {{Cos[k*Sqrt[Abs[cur]]*lq], Sin[k*Sqrt[Abs[cur]]*lq]/(
k*Sqrt[Abs[cur]])}, {-k*Sqrt[Abs[cur]]*
Sin[k*Sqrt[Abs[cur]]*lq], Cos[k*Sqrt[Abs[cur]]*lq]}}.{{1,
ld}, {0, 1}},
m = {{1, ld}, {0, 1}}];
AppendTo[LM, m]]];
M[line, line[[3]], line[[4]], line[[5]], 1.8]
Where Dimensions[line]={5,15} the first 2 rows of which are strings and the remainder numbers.
For LM I get LM={}
Any help very much appreciated.
Christina
I have the following code which runs without error but gives no output. It's probably simple but I just can't see the problem.
LM={};
M[line_, cur_, lq_, ld_, k_] := For [i = 1, Length[line[[1]]], i++,
Module[{m}, If[line[[1, i]] == "Q",
m = {{Cos[k*Sqrt[Abs[cur]]*lq], Sin[k*Sqrt[Abs[cur]]*lq]/(
k*Sqrt[Abs[cur]])}, {-k*Sqrt[Abs[cur]]*
Sin[k*Sqrt[Abs[cur]]*lq], Cos[k*Sqrt[Abs[cur]]*lq]}}.{{1,
ld}, {0, 1}},
m = {{1, ld}, {0, 1}}];
AppendTo[LM, m]]];
M[line, line[[3]], line[[4]], line[[5]], 1.8]
Where Dimensions[line]={5,15} the first 2 rows of which are strings and the remainder numbers.
For LM I get LM={}
Any help very much appreciated.
Christina