Writestruct() 'Scalar' Error
    10 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Rod Lopez
 il 10 Feb 2021
  
    
    
    
    
    Commentato: Rod Lopez
 il 15 Feb 2021
            I am attempting to use writestruct() to save a structure to a .csv file, using version 2020b.
I started by calling writestruct as follows: writestruct(S,fullname), where S is the structure, and fullname is fullname=[path filename], which was obtained via uiputfile.
When I run this, I receive this error: Expected S to be a scalar.
I figured that the structure S could be anything as long as it is a structure, what am I missing?
Thank you!!
2 Commenti
  Geoff Hayes
      
      
 il 10 Feb 2021
				Rod - try running the following in your command window
which writestruct -all
What does this return? Just a single reference to the writestruct function or something else? Also, have you tried the examples at writestruct examples to see if they work for you? If they do, you may want to post some  of the code that shows us what your structure looks like and how you are calling the function.
Risposta accettata
  Walter Roberson
      
      
 il 10 Feb 2021
        No, you must use a scalar structure, not a non-scalar structure.
S(1).this = 'that';
writestruct(S, 'junkfile.xml');
%scalar okay
S(2).this = 'the other';
writestruct(S, 'junkfile.xml');
%not okay
3 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Data Type Identification in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!