How to execute matrix variable values as iterations?
1 次查看(过去 30 天)
显示 更早的评论
In the GUI like in the first picture, there are 6 values
Enter the values. Press the 'loopExecute' button to execute the repeat statement as shown in the third picture.
The iteration statement is executed in a double manner and is operated by the assigned values as shown in the second picture.
But it doesn't work. The operating principle I want is as follows.
For example, if 'Seed' has a step of 0.5 from 2 to 7, the values of 2, 2.5, 3, 3.5... 6.5, and 7 are assigned to 'Channel_Seed.txt', and the exe file reads the values in order to perform the program.
I need your help.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1018805/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1018810/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1018815/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1018820/image.png)
4 个评论
Voss
2022-6-1
编辑:Voss
2022-6-1
function pushbutton_loopExecute_Callback(hObject, eventdata, handles)
global StartSeed;
global StopSeed;
global StepSeed;
global StartEbN0;
global StopEbN0;
global StepEbN0;
for Channel_Seed = [StartSeed:StepSeed:StopSeed]
for Channel_EbN0 = [StartEbN0:StepEbN0:StopEbN0]
writematrix(Channel_Seed);
type 'Channel_Seed.txt';
writematrix(Channel_EbN0)
type 'Channel_EbN0,txt';
system('"Decoding.exe" arg0 arg1');
systme('"DeModulation.exe" arg0 arg1');
end
end
Voss
2022-6-1
编辑:Voss
2022-6-1
@건희 이: I think @Jan was asking you to explain what you mean when you say, "it doesn't work", i.e., How is the behavior you see different than what you hope to see? You've given a description of how it should work, so now we know that much, but what do you actually observe when you run the code?
By the way, if the exe expects a file called ch.txt, then you better create that file in your loop (instead of creating Channel_Seed.txt):
writematrix(Channel_Seed,'ch.txt');
(and probably you'd want to put that file in the same directory where the exe is, not in MATLAB's working directory.)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!