start a while loop on working with a file in gui

1 回表示 (過去 30 日間)
Lev Mihailov
Lev Mihailov 2020 年 3 月 20 日
コメント済み: Rik 2020 年 3 月 20 日
Help me please! I need to make a loop that will read information from the file
function pushbutton1_Callback(hObject, eventdata, handles)
[file,path] = uigetfile('*.apa');
[file, ~] = fopen(fullfile(path,file));
fileinfo=dir(path);
filesize=fileinfo.bytes;
i=1
while (~feof(file)) && (ftell(file)<filesize)
a=fread(file,[1,1],'single');
b=fread(file,[1,1],'single');
addz=fread(file,[1,1],'single');
bitadd=fread(file,[1,1],'single');
if (addz==1)&&(bitand(bitadd,16))
ad(i)=a
bd(i)=b
for j=1:length(ad)
intaddora(j)=a(j)+1;
intaddorb(j)=a(j)-1;;
end
i=i+1
end
end
The first part opens the file and I want it to be immediately considered in the loop? , but in static text i = 1, i.e. the cycle does not count, please help me fix it
  5 件のコメント
Lev Mihailov
Lev Mihailov 2020 年 3 月 20 日
in some files you need to tighten checks (files were not written correctly)
Rik
Rik 2020 年 3 月 20 日
You can enable breakpoints by clicking on the dash next to the line number in the editor.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by