- Incorrect Dimensions in Reshape: The error might be due to dimensions specified in the reshape function not matching the total number of elements in textString. Ensure product of dimensions to reshape matches the length of textString.
- Data Type Mismatch: Ensure correct handling of data types."Char" function changes numeric ASCII values into characters. For reshaping back into an image, conversion to uint8 is used. This step should work well but verify that operations leading to textString generate integer ASCII values.
- Matrix Multiplication Issue: Verify that "textString = binValues*binMatrix" correctly performs matrix multiplication for binary to decimal conversion. Confirm binValues is defined as [128 64 32 16 8 4 2 1] or a similar sequence for the binary format. Additionally, check that this multiplication accurately transforms binary columns into decimal ASCII values.
- Debugging Steps:
- Check the dimensions of “All_img_Malicious{i}” and ensure they match expected dimensions of textString when reshaped. Use “numel(textString)” to compare against the product of the intended dimensions.
- Ensure that binMatrix is correctly formed and that binValues is correctly defined for binary to decimal conversion.
- Inspect intermediate variables (textString, binMatrix, etc.) to ensure they hold the expected values.
- Char- https://www.mathworks.com/help/matlab/ref/char.html?searchHighlight=char&s_tid=srchtitle_support_results_1_char
- Numel- https://www.mathworks.com/help/matlab/ref/double.numel.html?searchHighlight=numel&s_tid=srchtitle_support_results_1_numel