uitable - how to extract negative numbers (but there is also empty cells) from a ui table in GUIDE
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nathan Kennedy
am 28 Sep. 2018
Bearbeitet: Adam Danz
am 28 Sep. 2018
Hi,
I am having issues extracting data from a ui table in GUIDE. The ui table has empty cells and also negative numbers. I need the empty cells to be zeros and the negative numbers are giving me errors.
I have tried str2double(cell2mat(ui_table_data)) and some other combinations but I think I have the wrong end of the stick of how this is done in MATLAB.
Is there a good way of doing this?
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 28 Sep. 2018
Bearbeitet: Adam Danz
am 28 Sep. 2018
Here's a solution that identifies what elements of the cell array contains data and then moves those elements to a matrix initialized with zeros.
This assumes ui_table_data was taken from your UI table ( hObject.Data ).
hasData = ~cellfun(@isempty, ui_table_data);
uiTableData = zeros(size(ui_table_data));
uiTableData(hasData) = [ui_table_data{hasData}];
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!