Skip to content

How do I read a dense Tensor Toolbox tensor from a MATLAB .mat file? #349

Answered by tgkolda
tgkolda asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I more or less answered my own question:

# Load the MAT file for Example 1.3
mat_contents = loadmat('example_1_3.mat')
X_mat = mat_contents['X']
data = X_mat[0,0][0]
shape = tuple(X_mat[0,0][1][0])
X = ttb.tensor(data, shape)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tgkolda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant