How to extract multiple numbers from an Excel cell?

3 Ansichten (letzte 30 Tage)
Lexington Stoyell
Lexington Stoyell am 7 Feb. 2018
Kommentiert: dpb am 7 Feb. 2018
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 Kommentare
Lexington Stoyell
Lexington Stoyell am 7 Feb. 2018
How to extract multiple numbers (as shown in the image) from a Excel cell (to then put into two separate arrays).
dpb
dpb am 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... :)

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by