Calling a function with input size that varies.
古いコメントを表示
Hi all I am having problems calling a function with a number of inputs from a different file.
The function I want to call works like this when called from the command window. The_name(A,B,C,D,E), but the problem is C is the number of components for the problem. So if C is 6 it will then ask for what each (i) component is and then conditions D(i) E(i) for each of them. So the number of input changes as C changes. This function gets its input from the matlab command window(GUI I guess?). So I would call it as The_Name and it would ask me for, A, B, C, What is C, D(i), E(i) all the way until i = C
But when I try and call this function from another I can't get it to run with the proper amount of inputs. It either errors, or doesn't calculate properly.I am very very new to MatLab and programming in general. So sorry if this question is simple or whatever. Also I am new to the forums so if I break any of the norms/rules here I apologize in advance!
tldr;The function is this. GetKValues(p,T, component_numbers, x_compositions, y_compositions)
You enter in P,T,C. Once C is entered it then asks you for the identity of component i, and then x(i) y(i). But if I call this function from a script, it will only accept the 5 inputs (p,T, component_numbers, x_compositions, y_compositions)
回答 (2 件)
Azzi Abdelmalek
2013 年 3 月 8 日
0 投票
I'm not sure to understand, I think you can use one cell array containing all your inputs
the cyclist
2013 年 3 月 8 日
0 投票
Does this help?
カテゴリ
ヘルプ センター および File Exchange で Get Started with MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!