Open txt file with UI control and pass to Class
Good eve everybody,
Im trying to create an app to visualize data from a huge array. This array is stored in a CWF file but I can open it in notepad and read it easily so I gues I should be able to open it with a press on a button and start the OpenDialog select the file and pass the data to a class so I can extract all the data I need. Well it look easy but for some kind of reason I make a mistake and maybe someone can point out what I do wrong.
% So this code opens the dialog and I’m able to select the file I need. I
% expect that the file will be imported into A. Load data is a class where
% I want to exract everything.
function LoadChannel1ButtonPushed(app, event)
[file,path] = uigetfile(‘*.cwf’);
if isequal(file,0)
disp(‘User selected Cancel’);
else
A = importdata(file, ‘ ‘)
app.LoadData(A);
end
end
Unfortunately I get the error message ‘unable to open file’ , I have tried also the path together with the file but no luck. But when I code the load function with the path including the filename all goes well.
I think I make a mistake with file but I don;t see what.
Thanks for the help in advanceGood eve everybody,
Im trying to create an app to visualize data from a huge array. This array is stored in a CWF file but I can open it in notepad and read it easily so I gues I should be able to open it with a press on a button and start the OpenDialog select the file and pass the data to a class so I can extract all the data I need. Well it look easy but for some kind of reason I make a mistake and maybe someone can point out what I do wrong.
% So this code opens the dialog and I’m able to select the file I need. I
% expect that the file will be imported into A. Load data is a class where
% I want to exract everything.
function LoadChannel1ButtonPushed(app, event)
[file,path] = uigetfile(‘*.cwf’);
if isequal(file,0)
disp(‘User selected Cancel’);
else
A = importdata(file, ‘ ‘)
app.LoadData(A);
end
end
Unfortunately I get the error message ‘unable to open file’ , I have tried also the path together with the file but no luck. But when I code the load function with the path including the filename all goes well.
I think I make a mistake with file but I don;t see what.
Thanks for the help in advance Good eve everybody,
Im trying to create an app to visualize data from a huge array. This array is stored in a CWF file but I can open it in notepad and read it easily so I gues I should be able to open it with a press on a button and start the OpenDialog select the file and pass the data to a class so I can extract all the data I need. Well it look easy but for some kind of reason I make a mistake and maybe someone can point out what I do wrong.
% So this code opens the dialog and I’m able to select the file I need. I
% expect that the file will be imported into A. Load data is a class where
% I want to exract everything.
function LoadChannel1ButtonPushed(app, event)
[file,path] = uigetfile(‘*.cwf’);
if isequal(file,0)
disp(‘User selected Cancel’);
else
A = importdata(file, ‘ ‘)
app.LoadData(A);
end
end
Unfortunately I get the error message ‘unable to open file’ , I have tried also the path together with the file but no luck. But when I code the load function with the path including the filename all goes well.
I think I make a mistake with file but I don;t see what.
Thanks for the help in advance uiopen, matla MATLAB Answers — New Questions