Skip to content

Commit 161ccd2

Browse files
committed
Release v0.2.0-beta
Merge release/v0.2.0-beta into main Features: - v5 Writer complete (all numeric types, complex, multi-dim, both endianness) - Critical parser bug fixes (tag detection, multi-dim arrays, multiple variables) - All round-trip tests passing (100%) - Production quality: 0 linter issues, 78.5% coverage See CHANGELOG.md for full details
2 parents 6dd5c68 + ee8effc commit 161ccd2

File tree

10 files changed

+1863
-108
lines changed

10 files changed

+1863
-108
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
---
99

10+
## [0.2.0-beta] - 2025-11-06
11+
12+
### Added - v5 Writer Support ✨
13+
- **v5 Writer**: Complete MATLAB v5 format writer implementation
14+
- All numeric types: `double`, `single`, `int8`-`int64`, `uint8`-`uint64`
15+
- Complex numbers (real + imaginary parts)
16+
- Multi-dimensional arrays (1D, 2D, 3D, N-D)
17+
- Both endianness: MI (little-endian) and IM (big-endian)
18+
- Proper 8-byte alignment and padding
19+
- **Public API**: `Create(filename, Version5)` - Create v5 MAT-files
20+
- **Round-trip verified**: v5 write → v5 read → verify working perfectly
21+
22+
### Fixed - v5 Parser Bugs 🐛
23+
- **Critical bug**: Fixed tag format detection in `internal/v5/data_tag.go`
24+
- **Issue**: `readTag()` completely broken (checked `0xffffffff` instead of proper format detection)
25+
- **Impact**: All matrix parsing failed with EOF errors
26+
- **Solution**: Proper small format detection (upper 16 bits = size 1-4)
27+
- **Multi-dimensional arrays**: Now correctly preserve dimensions (was reading as 1D)
28+
- **Multiple variables**: Can now read files with multiple variables (was failing)
29+
- **All round-trip tests**: Now passing (100% success rate)
30+
31+
### Quality Improvements
32+
- **Linter**: 0 errors, 0 warnings ✅
33+
- **Tests**: All passing (100%), including previously skipped tests
34+
- **Coverage**: 78.5% (main package), 51.8% (v5), 48.8% (v73)
35+
- **Production-ready**: v5 Writer + Reader fully functional
36+
37+
### Developer Experience
38+
- Comprehensive unit tests (17+ test functions for v5 Writer)
39+
- Table-driven tests for type conversions
40+
- Round-trip tests for both v5 and v7.3 formats
41+
- Professional code quality (follows Go best practices 2025)
42+
43+
---
44+
1045
## [0.1.1-beta] - 2025-11-03
1146

1247
### Fixed - Complex Number Format ✨

README.md

Lines changed: 85 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ A modern, pure Go library for **reading and writing** MATLAB `.mat` files withou
2121
**Read & Write Support**
2222
- 📖 Read MATLAB v5-v7.2 files (traditional format)
2323
- 📖 Read MATLAB v7.3+ files (HDF5 format)
24-
- ✍️ **Write MATLAB v7.3+ files** (HDF5 format) - NEW!
25-
- ✍️ Write v5 format (coming in v0.2.0)
24+
- ✍️ **Write MATLAB v7.3+ files** (HDF5 format)
25+
- ✍️ **Write MATLAB v5-v7.2 files** (traditional format) - **NEW in v0.2.0!**
2626

2727
🎯 **Key Capabilities**
2828
- Simple, intuitive API
@@ -88,6 +88,8 @@ func main() {
8888

8989
### Writing MAT-Files
9090

91+
#### v7.3 Format (HDF5-based)
92+
9193
```go
9294
package main
9395

@@ -134,6 +136,65 @@ func main() {
134136
}
135137
```
136138

139+
#### v5 Format (Traditional Binary) - **NEW in v0.2.0!**
140+
141+
```go
142+
package main
143+
144+
import (
145+
"log"
146+
147+
"github.com/scigolib/matlab"
148+
"github.com/scigolib/matlab/types"
149+
)
150+
151+
func main() {
152+
// Create new MAT-file (v5 format - legacy compatible)
153+
writer, err := matlab.Create("output_v5.mat", matlab.Version5)
154+
if err != nil {
155+
log.Fatal(err)
156+
}
157+
defer writer.Close()
158+
159+
// Write a simple array
160+
err = writer.WriteVariable(&types.Variable{
161+
Name: "A",
162+
Dimensions: []int{3},
163+
DataType: types.Double,
164+
Data: []float64{1.0, 2.0, 3.0},
165+
})
166+
if err != nil {
167+
log.Fatal(err)
168+
}
169+
170+
// Write a matrix (multi-dimensional)
171+
err = writer.WriteVariable(&types.Variable{
172+
Name: "B",
173+
Dimensions: []int{2, 3},
174+
DataType: types.Double,
175+
Data: []float64{1, 2, 3, 4, 5, 6},
176+
})
177+
if err != nil {
178+
log.Fatal(err)
179+
}
180+
181+
// Write complex numbers
182+
err = writer.WriteVariable(&types.Variable{
183+
Name: "C",
184+
Dimensions: []int{2},
185+
DataType: types.Double,
186+
IsComplex: true,
187+
Data: &types.NumericArray{
188+
Real: []float64{1.0, 2.0},
189+
Imag: []float64{3.0, 4.0},
190+
},
191+
})
192+
if err != nil {
193+
log.Fatal(err)
194+
}
195+
}
196+
```
197+
137198
## Supported Features
138199

139200
### Reader Support
@@ -151,36 +212,40 @@ func main() {
151212
| Function handles |||
152213
| Objects |||
153214

154-
### Writer Support (v0.1.1-beta)
215+
### Writer Support (v0.2.0)
155216

156217
| Feature | v5 (v5-v7.2) | v7.3+ (HDF5) |
157218
|----------------------|--------------|--------------|
158-
| Numeric arrays | 📋 Planned ||
159-
| Complex numbers | 📋 Planned |* |
160-
| Character arrays | 📋 Planned ||
161-
| Multi-dimensional | 📋 Planned ||
219+
| Numeric arrays |||
220+
| Complex numbers |||
221+
| Character arrays | ⚠️ Partial ||
222+
| Multi-dimensional |||
223+
| Both endianness | ✅ MI/IM | N/A |
162224
| Structures | ❌ Future | ❌ Future |
163225
| Cell arrays | ❌ Future | ❌ Future |
164226
| Compression | ❌ Future | ❌ Future |
165227

166-
## Known Limitations (v0.1.1-beta)
228+
## Known Limitations (v0.2.0-beta)
167229

168230
### Writer Limitations
169-
- **v5 format writing not yet implemented** (coming in v0.2.0)
170231
- No compression support yet
171232
- No structures/cell arrays writing yet
233+
- Character arrays (partial support for v5 Writer)
172234

173-
### Reader Issues
174-
- Some bugs with multi-dimensional arrays (being fixed)
235+
### Reader Limitations
175236
- Limited support for structures and cell arrays
176-
- Multiple variables in one file may have issues
237+
- No compression support
177238

178239
### What Works Well ✅
179-
- All numeric types (double, single, int8-64, uint8-64)
180-
- Multi-dimensional arrays (write)
181-
- **Complex numbers** (proper MATLAB v7.3 format) ✨ FIXED in v0.1.1-beta
182-
- Round-trip write → read verified
183-
- Cross-platform (Windows, Linux, macOS)
240+
-**v5 Writer COMPLETE** - All numeric types, complex numbers, multi-dimensional arrays ✨ NEW in v0.2.0-beta
241+
-**v7.3 Writer COMPLETE** - Full HDF5-based writing
242+
-**Parser bugs FIXED** - Multi-dimensional arrays, multiple variables ✨ FIXED in v0.2.0-beta
243+
- ✅ All numeric types (double, single, int8-64, uint8-64)
244+
- ✅ Multi-dimensional arrays (read & write)
245+
- ✅ Complex numbers (proper MATLAB format for both v5 and v7.3)
246+
- ✅ Round-trip verified (v5 write → read, v7.3 write → read)
247+
- ✅ Cross-platform (Windows, Linux, macOS)
248+
- ✅ Both endianness (MI/IM for v5)
184249

185250
See [CHANGELOG.md](CHANGELOG.md) for detailed limitations and planned fixes.
186251

@@ -319,9 +384,9 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
319384

320385
---
321386

322-
**Status**: Beta - Read and Write support for v7.3 format (proper complex numbers!)
323-
**Version**: v0.1.1-beta
324-
**Last Updated**: 2025-11-03
387+
**Status**: Beta - Read and Write support for both v5 and v7.3 formats!
388+
**Version**: v0.2.0-beta
389+
**Last Updated**: 2025-11-06
325390

326391
**Ready for**: Testing, feedback, and real-world usage
327392
**Not ready for**: Production use (API may change)

0 commit comments

Comments
 (0)