horzcat error Conversion to struct from double is not possible.
3 views (last 30 days)
Show older comments
??? Error using ==> horzcat
The following error occurred converting from double to struct:
Error using ==> struct
Conversion to struct from double is not possible. Error in ==> svds at 65 B = [sparse(m,m) A; A' sparse(n,n)];
Error in ==> srmsvd at 9 [u,s,v,flag] = svds(A,neigs,'L',opts);
Error in ==> run_srm at 4 srmsvd(datapath,neigs);
code where error is occuring
:
function [U,S,V,flag] = svds(varargin)
A = varargin{1};
[m,n] = size(A);
p = min(m,n);
q = max(m,n);
B = [sparse(m,m) A; A' sparse(n,n)];
srmsvd:
function [] = srmsvd(datapath,neigs)
A = load(datapath)
disp 'data loaded'
disp(['neigs set to ' num2str(neigs)])
opts.issym = 0;
opts.isreal = 1;
opts.disp = 0;
[u,s,v,flag] = svds(A,neigs,'L',opts);
run_srm:
datapath = 'twitter_data.mat'; %path to matlab file with sparse data matrix
neigs = 50; %number of eigenvectors
srmsvd(datapath,neigs);
0 Comments
Answers (1)
Walter Roberson
on 16 Jul 2017
The result of
A = load(datapath)
is going to be a struct in which there is one field for every variable loaded from the .mat file. You need to extract the appropriate variable.
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!