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!