Info
此问题已关闭。 请重新打开它进行编辑或回答。
any suggests, solutions ?
1 次查看(过去 30 天)
显示 更早的评论
i have a set of parameters, and i want fo create a file function that containt all my parameters in order to use them in others programs, but i can't find the way to do that !
0 个评论
回答(2 个)
dpb
2020-2-28
Jeremy is correct...
ncparamteres.m would contain:
%ncparamteres.m
% Script to create variables in the calling MATLAB workspace
nc = 500;
T = 365;
t = 0:T/(nc-1):T;
I=500;
...
% the rest shouldn't be hard to decipher... :)
Alternatively, create an Initialization routine that is run once and saves the desired variables in a .mat file -- then just load that file and all the variables will appear like magic.
5 个评论
dpb
2020-2-29
编辑:dpb
2020-2-29
PLEASE! USE THE CODE Button to format the code (or highlight the code and presse CTRL_e)
That error has nothing to do with load, you're trying to assign a RHS of the assignment that is not compatible to the LHS which says the RHS has to be one value because you wrote a subscript of (1,1) on f.
But, we have no way to know what I, Philambda, and muN are as far as their dimensions; one must presume one or more of them is not just a single value but an array or vector.
However, going clear back to your first m-file, we can see that in it
Philambda=(1-lambda)./(1+((1-lambda)/P0-1)*exp(-alpha*t));
and t was a vector so presuming the same definition still holds, Philambda is the same size as t and therefore you're trying to stuff 500 values into one location. No can do.
Use the debugger and consider what you're really doing including whether you have and want arrays or values, don't just throw code at MATLAB and then expect somebody else to figure out what's wrong.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!