Hi Dwayn,
Based on the code you provided, it seems like the issue with the first cell being empty in your string array `mode1_status` is due to the initialization of the array with `strings(size(11))`. This creates an array of empty strings with a size of 11, which results in the first cell being empty when you append values to it within the while loop.
To ensure that the first cell is not empty and contains the fail or pass string, you can modify the initialization of `mode1_status` to include an initial value. You can set the first cell of the array to either 'Pass' or 'Fail' before entering the while loop. Here's an updated version of your code:
n = 1;
sigma_f = [118.01 97.84 84.51 67.98 58.13 50.29 45.08 41.36 38.58 36.42 34.70];
m_sigma_yf = 280;
s_factor = 5;
% Initialize as a 1x12 string array
mode1_status = strings(1, 12);
% Set initial value for the first cell
if sigma_f(1) < m_sigma_yf/s_factor mode1_status(1) = 'Pass'; else mode1_status(1) = 'Fail'; end
while n < 12 if sigma_f(n) < m_sigma_yf/s_factor
% Adjust index to avoid overwriting initial value
mode1_status(n+1) = 'Pass';
else
% Adjust index to avoid overwriting initial value
mode1_status(n+1) = 'Fail'; end n = n + 1; end
By setting an initial value for the first cell of `mode1_status` before entering the while loop and adjusting the index inside the loop, you can ensure that the first cell is not empty and contains the fail or pass string based on your condition. Feel free to test this updated code and let me know if you encounter any further issues or require additional assistance.