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.
0 个评论
回答(2 个)
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(:))
Surely an exponent of ^23 is a mistake...
5 个评论
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.
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
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...
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!