how to create a combination of excel values in matlab

1 view (last 30 days)
I have an excel sheet. And i created an export folder . Later i want to import that combination in GUI.

Answers (2)

dpb
dpb on 3 Jul 2023
M=[35 10 2;48 20 23].';
[m,b,e]=ndgrid(M(1,:),M(2,:),M(3,:));
v=arrayfun(@(m,b,e)m.*b.^e,m(:),b(:),e(:))
v = 8×1
1.0e+31 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2.9360 4.0265
Surely an exponent of ^23 is a mistake...
  5 Comments
dpb
dpb on 7 Jul 2023
Edited: dpb on 7 Jul 2023
Well, can't do that to a table, but we've no idea what you're trying to do with just one line in isolation...what the answer illustrates is the answer to the Q? originally posted, but <you've got to dereference the table> to get the array values. table
It doesn't help that you also wiped out the original posting so now there's absolutely no context for any of the conversation.
Restore the original Q? and show your work that led to the problem.
PA
PA on 7 Jul 2023
i want to create a combinations from the table as shown in the I column.

Sign in to comment.


dpb
dpb on 8 Jul 2023
Edited: dpb on 8 Jul 2023
t=array2table([8 8 1;11 11 2].','VariableNames',{'V1','V2'}); % simulate table (next time attach the file)
M=[t.V1 t.V2]; % extract array from table
%M=t{:,end-1:end}; % ditto, alternative syntax
ii=[kron([1;4],ones(4,1)) repmat([2 3;2 6;5 3;5 6],2,1)]; % construct indices into array
M(ii) % create pattern via indices
ans = 8×3
8 8 1 8 8 2 8 11 1 8 11 2 11 8 1 11 8 2 11 11 1 11 11 2
I don't see a combinatoric that does what you're asking for otomh...may be one, but it's not apparent to me how to generate it other than brute force...
Next time you want to ask a Q?, though, attach the data to go with it; images are not a substitute except when it is a visual effect one is trying to match or the like; it's much more likely to get help if folks don't have to create test case data in order to work on your problem. "Help us help you!!!"
And don't edit away the original; add comments if needed, or amplify, but don't destroy the context. Most won't bother after such...

Community Treasure Hunt

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

Start Hunting!