Questions tagged [matlab-struct]

For questions about the MATLAB structure datatype.

A structure is a datatype in MATLAB. It is different from cells and arrays in that it uses field names, and within fields one can store other data, also of type struct, cell, array, etc.

MathWorks has a tutorial on accessing data in a structure array.

The basic function to create one is, among others, struct.

145 questions
0
votes
1 answer

loop through field in a matlab struct array

I have a MatLab struct array as follow: 'country.source.scenario.category.entity= year' I would like to loop over the existing 'country.source.scenario' combinations and produce cell or matrix containing the fields: category, entity and year. Anyone…
steve
  • 511
  • 1
  • 9
  • 33
0
votes
0 answers

Dealing with structs in Matlab

I'm using the Fuzzy Logic Toolbox and exporting the FIS to the workspace (for plots and so on). The exported FIS is a 1x1 struct with all the information about the fuzzy system and I'd like to work with that inside the editor (.m) but I don't know…
cieslak
  • 1
  • 3
0
votes
1 answer

Matlab struct computations

I download data from Yahoo! Finance with: data = getYahooDailyData({'MSFT', 'axp'},'01/01/2000', '01/01/2015', 'dd/mm/yyyy'); and the data is stored as a 1x1 struct. I now want to create a Tx2 matrix of the daily adjusted closing prices for MSFT…
0
votes
1 answer

Allocating an array of two dimensions of struct in MATLAB

I have a problem, I want to allocate a block of memory of size m and n (so a 2D matrix) where each element of the matrix is a struct of 2 variables ( a point with 2 double coordinates x and y). The language I want to write this in is MATLAB I have…
Mircea Paul Muresan
  • 628
  • 1
  • 9
  • 23
0
votes
0 answers

matlab getYahooDailyData struct object to simple matrix (double)

From the function getYahooDailyData (available on:) http://www.mathworks.com/matlabcentral/fileexchange/43627-download-daily-data-from-google-and-yahoo--finance/content/getYahooDailyData.m I try the following code. symbols = {'000001.SZ',…
S12000
  • 3,345
  • 12
  • 35
  • 51
0
votes
1 answer

matlab - how do I sort a struct by values?

I have this struct: s = p_10_50_10_70: 0.1176 p_10_50_15_10: 0.9235 p_10_50_15_70: 0.2456 p_10_50_base: 0.0100 p_10_70_15_10: 0.0895 p_10_70_15_70: 0.0053 p_10_70_base: 6.3711e-06 p_15_10_15_70: 0.1892 p_15_10_base: 0.0047 p_15_70_base:…
Mazatec
  • 11,481
  • 23
  • 72
  • 108
0
votes
1 answer

Matlab going from text to struct

I have an m-file with a big (working) structure. After lots of effort I've found a way to update some of structs with fprint etc. I got the file saved and everything seems good when it´s saved but I want to use the struct further down in the…
axel_ande
  • 359
  • 1
  • 4
  • 20
0
votes
4 answers

Error using minus in MATLAB

temp(i,1) = rand(1)*(pb(1,num).pos(i,1) - pw(1,num).pos(i,1)); This line gives the following error: Error using ==> minus Not enough input arguments. The following are the definitions of pb and…
-1
votes
1 answer

How do I organize this data into structures in MATLAB?

Say for n=5, the following code gives me a plot for n randomly generated nodes. These nodes are not structures (just plotted points), but I want to assign every node a message just as I did for sink and source and keep track of the nodes identity…
gurwinder
  • 237
  • 1
  • 5
  • 13
-2
votes
1 answer

how to assign random energy E to every node and compare two nodes for maximum energy and also find distance between them?

As helped by gnovice I got following code, but now I want to assign energy (randomly) to every nodes using E=floor(rand(1)*10) and also want to compare for maximum energy and what is distance between them? N=input('no. of nodes : '); %#…
gurwinder
  • 237
  • 1
  • 5
  • 13
1 2 3
9
10