About 252,000 results
Open links in new tab
  1. struct - Structure array - MATLAB - MathWorks

    s = struct(field,value) creates a structure array with the specified field and value. The value input argument can be any data type, such as a numeric, logical, character, or cell array. If value is …

  2. arrays - MATLAB: add field to structure within a for loop - Stack Overflow

    Jan 25, 2016 · Note that the best way to add a field to a structure from a string value is of the form: <<struct_name>>. (<<field_name_str>>) = <<value>>. Also, the if statement tests …

  3. How can I create structure entries in a for loop.? - MathWorks

    Jan 8, 2022 · For instance, say I have three data sets for which I'd like to calculate the maximum and minimum values and create entries in a fields in a structure for each maximum and …

  4. How can I create a structure with a loop? - MATLAB Answers

    Jan 23, 2017 · If they were load-ed, then the best solution is to load them into a structure: S = load (...) and from there take the required fields and merge this into one variable (e.g. a cell array or …

  5. matlab - how is the best way to create a struct in a loop ... - Stack ...

    Jun 3, 2020 · I want to create a struct in a loop. this is the initial command lines: if condition. myStruct(i).a = i: myStruct(i).b = 1: else. myStruct(i) = myFunction(i): end. myFunction is as …

  6. creating a structure in for loop - MATLAB Answers - MathWorks

    Nov 22, 2019 · Hello, Is it possible to create a structure in a for loop field={'name1','name2'} for i=1:2 structure.(field{i})=value end Output: structure.name1=value structure.name2=value …

  7. Creating structure array using for loop - MATLAB Answers

    Hi everyone, So I'm having some trouble populating a structure array. I found a very helpful tdms file converter on the file exchange that when I run for a data set, gives me a 1x1 structure. I ha...

  8. for-loop over Structure Array - MATLAB Answers - MATLAB

    Feb 11, 2020 · I have written a loop over all structures grouped to an array, however calculations are only saved to the index (i) of the loop , not to the original structures in the array. So only …

  9. How to initialize an array of structs in MATLAB?

    Dec 1, 2012 · There's a bunch of ways you can initialize a structure. For example, you can use the struct command: a(1:100) = struct('x',[]); which sets all fields x to empty. You can also use …

  10. How to create new structure with each for loop? - MATLAB

    Apr 10, 2022 · The backward loop forces Matlab to create the Nth structure array element first. As a result, it forces the entire structure array to be pre-allocated after the first iteration of the loop.

  11. Some results have been removed