How to execute matrix variable values as iterations?

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.

댓글 수: 4

Avoiuid using global variables because they are a shot in your knee.
"But it doesn't work" is too vague to be understood by the readers. Please explain this with details.
Please post code as formatted text, not as screenshot. Then the code can be reused by copy&paste to create an answer.
for k = [a:b:c]
is slower than
for k = a:b:c
because in the latter case Matlab does not create the index vector explicitly.
What do you expect "arg0" and "arg1" to be?
("Answer" from @건희 이 moved here:)
Dosen't work means: If you have a step of 0.5 from 2 to 7, the algorithm wants to be executed like this. A file named ch.txt stores a value of 2. The exe file then reads the value 2 from the ch.txt file and executes it. Again, ch.txt stores 2.5. The exe reads it. Once again, ch.txt stores 3.... I'm going to repeat.
Arg0 and arg1 have no special meaning. I use it unconsciously when I use the system function just to run the exe file
Voss
Voss 2022년 6월 1일
편집: Voss 2022년 6월 1일
("Answer" from @건희 이 moved here:)
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
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개)

카테고리

도움말 센터File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

2022년 6월 1일

편집:

2022년 6월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by