how find a decimal number in a table
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
tab=load('matlab_Tab.mat');
find(mod(tab.Tab,1)~=0);
1 comentario
Chuguang Pan
el 23 de Mzo. de 2025
mod(tab.Tab,1) is a Table, which is not supported by find operation.
Respuestas (2)
dpb
el 23 de Mzo. de 2025
Movida: dpb
el 23 de Mzo. de 2025
whos -file matlab_Tab.mat % see what is in the .mat file first
tab=load('matlab_Tab.mat');
tab % show it
tTab=tab.Tab; clear tab % somehow a table was saved into a struct; return it to the table
head(tTab) % show the content...
The function form of load returns the content of a .mat file as a struct with the variable names as fieldnames in the structure. In this case that turned the table, tab into a filed in the new tab variable.
The above gest the table back programmatically, the easier solution is to use the command form of load instead...
clear % remove everything so far so start clean...
load matlab_Tab
whos
head(Tab)
Now one has the original table without any unecessary machinations to get to it...
Now the question becomes one of what the
find(mod(tab.Tab,1)~=0);
command was intended to do?
Ver también
Categorías
Más información sobre Tables 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!