Syntax
b=sbuffercreate([n])
Input Parameter
n : | | number of bytes; default is 256 |
Output Parameter
Copyright 2015-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is a MATLAB function named sbuffercreate
that creates a buffer structure for asynchronous read/write operations. It is part of the SG-Library and was developed by Tim Lueth. The function is designed to initialize a buffer with a specified or default size.
Input Parameters
- n: The number of bytes for the buffer. If not provided, the default value is 256.
Output
- b: A structure representing the buffer.
Algorithm Steps
- Initialize the default buffer size
n
to 256.
- Check if an input argument is provided and is not empty. If so, set
n
to the provided value.
- Create a structure
b
with the following fields:
len
: Set to n
, representing the length of the buffer.
anz
: Initialized to 0, representing the number of used bytes in the buffer.
buf
: An array of unsigned 8-bit integers (uint8) with a size of n
, initialized to zeros. This array holds the data bytes of the buffer.
w
: Set to 4, possibly representing a write pointer or index.
r
: Set to 4, possibly representing a read pointer or index.
Algorithm explaination created using ChatGPT on 2025-08-18 22:54. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21