How to extract multiple numbers from an Excel cell?
조회 수: 3 (최근 30일)
이전 댓글 표시
I am attempting to create a matrix for both the values and then two for the limits (one for the upper limit, and one for the lower limit). I have pasted the code I created below, but I am having issues now that I am reading the values in using an Excel file, instead of defining the matrices myself in MatLab.
%A = [1 2; 3 4; 5 6]; %my array (the actual values)
A= Value_Col;
% B = [[0,2] [3, 5]; [2, 4] [1, 2]; [4, 6] [3, 9]]; %the limits
B= Limits_Col;
% Upper Limit
upper = B(:,2:2:end);
%Lower Limit
lower = B(:,1:2:end);
x = A <= upper; %x should be below (or equal to) the upper limit
y = A >= lower; %y should be above (or equal to) the lower limit
%compares the limits and creates a new matrix
% new matrix only includes the numbers are true for BOTH limit checks
% (upper and lower)
AFT_limits = x == y;
%multiples arrays of the same size by cells
%This would be the ouput on the final excel sheet
num = A .* AFT_limits;
댓글 수: 3
dpb
2018년 2월 7일
If you don't enter the values into separate cells in Excel the only way you'll be able to retrieve them is as text which comes back as a cell string for the given cell.
Then you'll have to parse that string to retrieve the components thereof.
Would be much simpler to not do that... :)
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!