MATLAB struct conversion error -


i have 5 different structure , want calculate variables of them. that, wrote following code:

for i=1:5 [structurei(i), reqtab(i), jt(i), b(i)]=checkall(e); end 

the values structurei, reqtab, jt , b calculated in function ,

structurei= 1x4 matrix, reqtab= 4x2 matrix, jt=2x1 matrix, b=4x4 matrix 

when run code calculates varibles in function checkall. however, when turns parent code, gives , error "conversion double struct not possible."

how can solve problem?

thanks in advance.

you cannot assign directly double struct, instead have write specific field field_name assign to:

[structurei(i).field_name, reqtab(i), jt(i), b(i)] = checkall(e); 

if of these variables (i.e. reqtab, jt, b) structures, off course need specify field in each 1 of them, using . notation.

however, mentioned in comments, iterations of loop same (no usage of i within it), why need loop? make 5 copies?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -