only one column with pop up window and import data into row

2 visualizaciones (últimos 30 días)
Tobias Wzl
Tobias Wzl el 18 de Oct. de 2017
Comentada: Tobias Wzl el 18 de Oct. de 2017
I got it done now, that if I click on any cell a menu appears where I can select my file. But I just want this for a specific column and I also want that the filename appears in the cell in the colour blue.
For the import of the data I have to use the import-command right? If yes how can I include this into my code?
CODE:
function uitable1_CellSelectionCallback(hObject, eventdata)
datatable_row = eventdata.Indices(1);
datatable_col = eventdata.Indices(2);
Columndata = get(hObject,'Data');
[FileName,PathName] = uigetfile({'*.txt'; '*.csv'},'Select the configuration');
if strcmp(Columndata(1,1),'User Defined')
FilePath = fullfile(PathName,FileName);
if isequal(FileName,0)
return
end
[pathstr, name, ext] = fileparts(FilePath);
ParameterList{end+1} = name;
set(uitable1,'ColumnFormat',{ParameterList});
end
end

Respuestas (1)

Jan
Jan el 18 de Oct. de 2017
1st question: "I just want this for a specific column"
Try this:
datatable_row = eventdata.Indices(1);
datatable_col = eventdata.Indices(2);
% Accept clicks on 2nd columns only:
if datatable_col ~= 2
return;
end
2nd question: "filename appears in the cell in the colour blue"
I have no idea, what this should do.
ParameterList{end+1} = name;
set(uitable1,'ColumnFormat',{ParameterList});
Is the name assumed to be a valid format?
Perhaps you mean
Columndata{datatable_col, datatable_row} = name;
And if you want to define the color:
str = ['<html><body color="#0000FF">', name '</body></html>']
Columndata{datatable_col, datatable_row} = str;
  5 comentarios
Jan
Jan el 18 de Oct. de 2017
You do not need Java, if you find another solution than hyper links in uitables.
Usually a uitable is used to display the contents of the file. But it is not clear yet, which data you want to display. E.g. why does the top left uitable cell contain the string 'User Defined'? What would be the purpose of the hyper link? Which function should be triggered by pressing it?
Can you create a sketch of how the GUI should look like?
Tobias Wzl
Tobias Wzl el 18 de Oct. de 2017
clearly it should display the content of my file. is it possibly to display the path of my file in an seperate edit text box which is included in the uitable?
the cell with the contain 'user defined' was just some playing around in matlab and some stuff I found on the Internet.
the sketch of my gui: (this is just a prototype some things could be added and some things can disappear in the end)

Iniciar sesión para comentar.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by