Error using textscan Invalid file identifier Use fopen to generate a valid file identifier in app designer
古いコメントを表示
I use a button to upload my "Data.txt" file and another button to calculate and plot it into UIaxes but im having error in "fid=fopen"
properties (Access = public)
selectpath='';
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: UploadButton
function UploadButtonPushed(app, event)
[file,path] = uigetfile('*.txt')
end
% Button pushed function: CalculateButton
function CalculateButtonPushed(app, event)
fid=fopen(Data.txt(app.selectpath));
fclose(fid); %Error using textscan
% Invalid file identifier.
% Use fopen to generate a valid file identifier.
seek=textscan(fid,'%f %f','headerlines',2);
g = cell2mat(seek);
x=g(:,1);
y=g(:,2);
[sortedX, sortIndex] = sort(x);
sortedY = y(sortIndex);
sortedXLimit = sortedX(1:160,:);
sortedYLimit = sortedY(1:160,:);
plot(app.UIAxes,value*peaks) %for the graph
app.UIAxes.YLim = [0 205];
5 件のコメント
darova
2020 年 4 月 29 日
I don't understand

Can you explain?
sydney salvador
2020 年 4 月 30 日
sydney salvador
2020 年 4 月 30 日
darova
2020 年 4 月 30 日
Try this

sydney salvador
2020 年 4 月 30 日
採用された回答
その他の回答 (1 件)
sydney salvador
2020 年 5 月 1 日
2 件のコメント
Tommy
2020 年 5 月 1 日
At this point I'd recommend you open a new question. If you do so, post a link here and I'd be more than happy to take a look!
sydney salvador
2020 年 5 月 1 日
カテゴリ
ヘルプ センター および File Exchange で Data Import and Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!