Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to increment the specific command

5 ビュー (過去 30 日間)
Akshay Kumar Kumaraswamy
Akshay Kumar Kumaraswamy 2018 年 6 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Par.Instr{5}.Obj.Write(['SOURce' num2str(lineNum) ':VOLTage:OFFSet ' num2str( Par.SigGen{lineNum}.PulseAmp)])
I need to increment the value of Par.SigGen{lineNum}.PulseAmp in the above code and I am calling the values from excel sheet like 4:0.1:5
When I run the above code its just take first value ie 4. How to make a cycle for 4,4.1,4.2....5?
Thank you.

回答 (2 件)

Geoff Hayes
Geoff Hayes 2018 年 6 月 1 日
Akshay - can't you just use a for loop like
for k=4:0.1:5
% do something
end
In the above we iterate from 4 to 5 with a step size (increment) of 0.1.

Fangjun Jiang
Fangjun Jiang 2018 年 6 月 1 日
編集済み: Fangjun Jiang 2018 年 6 月 1 日
A for-loop can be used, such as
for lineNum=4:0.1:5
num2str(lineNum)
end
But the "lineNum" in Par.SigGen{lineNum}.PulseAmp seems to be an index. It needs to be a non-zero integer such as 1, 2, 3. It can not be a decimal number such as 4.1, 4.2 etc.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by