-2
好的問題是,我想要接收數學函數。在程序運行之前我不知道有多少人。如何創建一個接受字符串的向量?
當它運行時,我要求一個n
函數的數量,我會收到它並開始保存它們從輸入。
到目前爲止,我有這個
function test()
n = input('number of equations?');
v = [1:n]
%in an ideal world, this^here would allow me to put a string in each position but
% they are not the same type and I understand that.. but how can I build a vector for saving my functions
%I want a vector where I can put strings in each position that is what I need
for i=1:n
x = input('what is the function?','s');
v(i)=x
end
v
%this would be my vector already changed with a function in each position.
end
非常感謝你! – user1907948