Undefined function or variable 'x'.

function T_lnew= Tnew(x)
global Tl1 Tl8;
for i=8:13
T_lnew(i-6)=x(i);
i=i+1;
end
T_lnew(1)=Tl1;
T_lnew(8)=Tl8;

1 件のコメント

KSSV
KSSV 2019 年 8 月 16 日
How did you call the function? Don' run the function...give input and call it.

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 16 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 16 日

0 投票

May Be??
function T_lnew=Tnew(x)
for i=8:13
T_lnew(i-6)=x(i);
end
Command Window:
>> Tnew(1:20)
ans =
0 8 9 10 11 12 13
No Need to defined global variable, as T_lnew is the return to main script, so you can acess the all elements of T_lnew from Main script
And based on indexing of x, it must be vector with more than 5 elments, also the start index position is 2 =(8-6), so it return the 0 in first index position
Also if you want to assign specific T_lnew index position, it must be pass to the the function or same can be done in main script.
To Calling a function in MATLAB see @Stephan's Answer here or search matlab documenation

3 件のコメント

Stephen23
Stephen23 2019 年 8 月 16 日
madhan ravi
madhan ravi 2019 年 8 月 16 日
Tnew(1:20)
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 16 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 16 日
@Stephen & @Madhan Sorry..missed it again Thanks Always.

この質問は閉じられています。

質問済み:

2019 年 8 月 16 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by