I am trying to pass an index for a loop when I call my script using batch. I plan on issuing a series of scripts each with a different index. Ideally I'd like to run a command like batch(myscript, indexstart,indexend) and then have those start and end indexes passed to my loop and execute.
Is this possible? and what command do I use inside my script to collect the parameters and place them into variables for the loop.
I'm used to seeing something like this in other languages:
call script using - batch('myscript', indexstart , indexend)
Inside my code:
grab parameter 1 and put in variable for starting index of loop
grab parameter 2 and put in variable for end index of loop
for i=indexstart to indexend
do stuff
end

댓글 수: 3

Geoff Hayes
Geoff Hayes 2018년 6월 5일
Ashley - perhaps you want to turn your script into a MATLAB function that will accept one or more input parameters...
Stephen23
Stephen23 2018년 6월 5일
편집: Stephen23 2018년 6월 5일
MATLAB isn't "other languages", it is MATLAB. Use a function. Functions are much better than scripts, and you should be using them anyway.
Ashley
Ashley 2018년 6월 5일
cool

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Big Data Processing에 대해 자세히 알아보기

질문:

2018년 6월 5일

편집:

2018년 6월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by