What does "Struct(1).file=Out_mat" mean?
    9 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Sigal Cohen
 il 17 Ago 2017
  
    
    
    
    
    Commentato: Stephen23
      
      
 il 17 Ago 2017
            I have a script that begins as follows:
 clearvars -except Struct
 program =2;
 addpath(genpath('G:\DATA SUM\ISI\310815\Aug.31,2015 15.44.55\TimtomlineData'));
 if program ==2
    clear all
    close all
    clc
 load('Cycle_1.mat'); 
 Struct(1).file=Out_mat;
Can someone help me figure what line: "Struct(1).file=Out_mat" does?
If the rest of the script is needed I would happily add it.
Thank you all, Sigal.
1 Commento
  Stephen23
      
      
 il 17 Ago 2017
				"I have a script that begins as follows:..."
Hopefully you were given that script as an example of how not to write code.
Risposta accettata
  Fergus McIlwaine
 il 17 Ago 2017
        Looks like 'Struct' is a structure array with a field named 'file'. The code is saving Out_mat to the first (1) value in the 'file' field.
https://www.mathworks.com/help/matlab/ref/struct.html
0 Commenti
Più risposte (1)
  Guillaume
      
      
 il 17 Ago 2017
        The whole excerpt you've posted is of poor quality. Unnecessary clear (twice!), close, inconsistent formatting, unnecessary path manipulation, load without a target, use of variable name that only differs from a basic matlab function name by case, meaningless variable name...
Presumably, the Out_mat variable is popped into existence by the load('Cycle1.mat'). That matrix is then assigned to the file field of the 1st element of the possibly non-scalar structure called Struct. That's all.
0 Commenti
Vedere anche
Categorie
				Scopri di più su Text Files 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!


