only one column with pop up window and import data into row
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
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
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?
Ver también
Categorías
Más información sobre Environment and Settings 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!