Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SingleStatementMatlabCommand"/> class.
        /// </summary>
        /// <param name="session">The <see cref="MatlabSession"/> this
        /// <see cref="SingleStatementMatlabCommand"/> is valid within,</param>
        /// <param name="cmd">The command to execute.</param>
        /// <exception cref="ArgumentException">cmd is null or empty.</exception>
        /// <exception cref="ArgumentNullException">session is null.</exception>
        public SingleStatementMatlabCommand(MatlabSession session, string cmd)
            : base(session)
        {
            if (string.IsNullOrEmpty(cmd))
            {
                throw new ArgumentException("cmd");
            }

            Input = cmd;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatlabCommand"/>
        /// abstract class.
        /// </summary>
        /// <param name="session">The <see cref="MatlabSession"/> this
        /// <see cref="MatlabCommand"/> is associated with.</param>
        /// <exception cref="ArgumentNullException">session is null.</exception>
        protected MatlabCommand(MatlabSession session)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            Session = session;
            Session.SessionValidityChanged += _onSessionValidityChanged;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Workspace"/> class.
        /// </summary>
        /// <param name="matlab">The current <see cref="MatlabSession"/> this
        /// <see cref="Workspace"/> belongs to.</param>
        /// <param name="name">The identifier to give to this
        /// <see cref="Workspace"/>.</param>
        /// <exception cref="ArgumentException">name is null or empty.</exception>
        /// <exception cref="ArgumentNullException">session is null.</exception>
        public Workspace(MatlabSession session, string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("name");
            }

            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            WorkspaceName = name;
            _session      = session;
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CompositeMatlabCommand"/>
        /// class.
        /// </summary>
        /// <param name="session">The <see cref="MatlabSession"/> this
        /// <see cref="MatlabCommand"/> is associated with.</param>
        /// <param name="cmds">The set of individual commands to execute.</param>
        /// <exception cref="ArgumentNullException">session or cmds are null.</exception>
        public CompositeMatlabCommand(MatlabSession session, IEnumerable <string> cmds)
            : base(session)
        {
            if (cmds == null)
            {
                throw new ArgumentNullException("session");
            }

            _commands = new List <SingleStatementMatlabCommand>();
            foreach (string cmd in cmds)
            {
                SingleStatementMatlabCommand command = new SingleStatementMatlabCommand(session, cmd);
                _commands.Add(command);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MatlabEngine"/> class.
 /// </summary>
 public MatlabEngine()
 {
     _session = new MatlabSession(new MLAppClass());
     Global   = new Workspace(_session, "global");
     Base     = new Workspace(_session, "base");
 }