How to extract multiple numbers from an Excel cell?
5 views (last 30 days)
Show older comments
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 Comments
dpb
on 7 Feb 2018
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... :)
Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!