I have a mat file containing a table one column with numbers from 1 to 50, I just want to assign avariable to first column an than apply this:
tf = ismember(M, [7; 8; 9]);idx = find(diff(tf)>0)+1+(0:12);answer = reshape(M(idx).', [], 1)
If I put
M = [1 2 3 4...49 50]
and then
tf = ismember(M, [7; 8; 9]);idx = find(diff(tf)>0)+1+(0:12);answer = reshape(M(idx).', [], 1)
I have the correct results that display only the numbers after 9 but I want to exclude the M = [1 2 3 4…49 50] and to assign a variable to entire column because my numbers are always different except 7,8,9
I tried this
M = T(:,:);
where T is the table from mat file but:
Error using table/ismember (line 27)
A and B must both be tables.
If I put directly:
tf = ismember(X, [7; 8; 9]); %X is table from mat file
idx = find(diff(tf)>0)+1+(0:12);vals = reshape(X(idx).', [], 1);
I get this error :
Error using +
Matrix dimensions must agree.
Thanks
Best Answer