how to create a combination of excel values in matlab

1 次查看(过去 30 天)
I have an excel sheet. And i created an export folder . Later i want to import that combination in GUI.

回答(2 个)

dpb
dpb 2023-7-3
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 个评论
dpb
dpb 2023-7-7
编辑:dpb 2023-7-7
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 2023-7-7
i want to create a combinations from the table as shown in the I column.

请先登录,再进行评论。


dpb
dpb 2023-7-8
编辑:dpb 2023-7-8
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...

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by