sbufferinfo

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - USB Interface
Introduced first in SolidGeometry 2.8, Creation date: 2015-12-08, Last change: 2025-09-14

returns information on a struct buffer

Description

the basic functions are:
sbuffercreate - create a buffer
sbufferinfo - status info about the buffer
sbufferwrite - write data into the buffer
sbufferget - read data out of the buffer


See Also: sbuffercreate , sbufferwrite , sbufferget

Example Illustration

 missing image of sbufferinfo(b)

Syntax

[f,l,u]=sbufferinfo(b)

Input Parameter

b: struct buffer

Output Parameter

f: number of free bytes
l: maximum number of bytes
u: number of used bytes




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 function, sbufferinfo, is designed to provide information about a buffer structure in MATLAB. It is part of a library for handling USB interfaces.

Input Parameters

Output Results

Algorithm Steps

  1. Retrieve the total buffer length l from b.len.
  2. Retrieve the number of used bytes u from b.anz.
  3. Calculate the number of free bytes f as f = l - u.
  4. If no output arguments are specified (nargout == 0), print the buffer size, used bytes, and free bytes to the console using fprintf.
  5. Calculate the buffer indices bi using a custom function mod1, which adjusts the indices based on the buffer's read position and length.
  6. Display the buffer contents using b.buf', which transposes the buffer data for display.
Algorithm explaination created using ChatGPT on 2025-08-18 23:03. (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