Structure Assignment to Non-Structure Object Error

13 views (last 30 days)
I'm trying to reassign structs from a loaded .mat file to a new .mat file.
In a loop I have the new struct I would like to load the information into equating the struct from the older .mat file
The code looks something like this
files = dir('*.mat')
for i= 1:numel(files)
fileName=files(i).name
load (fileName)
newstruct(1).struct = oldstruct.data
save (newstruct)
end
any ideas why I am getting this error?
  5 Comments
Walter Roberson
Walter Roberson on 4 Apr 2017
Sunil Kumar Patel:
In the line
if(C(i)<=(p/(1-p*mod(r,round(1/p)))))
the comparison involving C(i) can only work if C(i) is numeric.
Then a few lines later you use
C(cluster).type=S(i).type;
which tries to use C as a structure.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Jun 2013
The first argument to save() should be a filename. You are passing a structure instead.

More Answers (0)

Categories

Find more on Structures 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!