How to solve " Variable..... not found in scope...."? - openmodelica

I've tried to build a very simple model in order to learn using CombiTable in Open Modelica. I want to output the value of the table ( in particular y3 ).Can you help me please? I show you pictures with errors. Thank you very much. I'm using last version 1.12.0-64bit.

In line 3 you are setting columns=2:size(table,2). But variable table is nowhere defined in your script. You're probably thinking of table as an array, if that's the case, you have to define it.
If it's not the case and you're just testing modelica you can use a constant columns =2:N with N the number of columns in your table on the file.

Related

I need to sort an array in excel following the order of another one

Hello everyone and thanks a lot in advance for any help.
I'm not very good using Excel. I want to know if there is a simple way in which I can sort a small two-column data matrix following the order of a column that contains all the bird species in Colombia. I study birds and I usually do avifauna characterization studies. I've always had this problem of not being able to order efficiently using the taxonomic order of species. I have always done it by hand and it takes me a really long time.
This is the file with the example that ilustrates my problem: https://docs.google.com/spreadsheets/d/1089VD4ylJiW9Xw9xRFI0ehraAc_t-qSa/edit?usp=sharing&ouid=112790797352647984659&rtpof=true&sd=true
There are two worksheets in this file. One called "Species" and the other "Data". I need to know if it is possible to make Data array can be sorted following the Species column.
I have tried creating custom lists and the number of entries to create a certain order does not allow me to put more than 100. I have also tried using commands Sort and Sortby without any success.
Again, thanks a lot for any help.
Regrets.
On the Data worksheet, add a helper column:
C2: =MATCH(A2,Species!$A$1:$A$2000,0)
and fill down.
Then Sort by the helper column

Grouping Rows by variables in KableExtra

this is my first question here so I am uncertain on how to word things. However, I am looking into the kableExtra package for creating different tables than the ones I currently know in gt. This is my table output from gt.
enter image description here
Now what I am trying to do is group my kable table in a similar way to this. This data set is exactly what you see, with the addition of a column I have named "x" that includes Prevalence, Abundance, and Intensity for each different row. Is there a way to have a similar output for a kable table? The difficulty that I am having is because this table in gt is so lengthy it doesn't fit very well in a document. Thank you for any help.

Alternatives to interpolate three dimensional data

I have a table that shows me a chemical concentration value based on temperature, pH and
ammonia. The way the I measure these variables, the ammonia level are always one of these six values (on top of the table), so it works as a categorical variable.
I need a way to interpolate on this table, based on these 3 variables. I tried using a combination of INDEX and MATCH, but I was not able to achieve what I wanted. Then I thought of "dividing" the table in intervals to "reduce" one variable and use an IF function to select which interval to interpolate based on the third variable (I was thinking pH or Ammonia), but I can't figure out a way to change intervals dynamically like this.
Can anyone think of an alternative to accomplish what I'm trying to do? If possible I would like to avoid using VBA, but if there is no other way I have no problem using it.
Thank you for the help!
I'm attaching an example of the table below.
Assuming that PH is in Column A:
=INDEX(A:H;MATCH(6,8;A:A;0)+MATCH(25;B:B;0)-2;MATCH(2;2:2,0))
Where the -2 needs to be changed to the number of rows BEFORE the first 22 in Temp.
This also assumes that the pattern of 22;25;28 in Temp is the same for every pH

Creating a variable if key term appears in text

I am trying to create a variable "thromboembolism death", 0 if it is not the cause of death, 1 if it is.
Is there any way to sort through this data set through spss / excel in order to create a new variable if one of the key terms e.g (DVT, Pulmonary embolism, thromboembolism) appear in the line of text? Here is what my data looks like right now.
https://i.stack.imgur.com/WDrBs.png
Also the data set is very large. 250000+ cases. I am new to data analysis, thanks for the help!
In SPSS, assuming you have a variable named death_cause with description verbatims:
COMPUTE thromboembolism_death = (INDEX(UPCASE(death_cause),'DVT') > 0)
OR (INDEX(UPCASE(death_cause),'PULMONARY EMBOLISM') > 0)
OR (INDEX(UPCASE(death_cause),'THROMBOEMBOLISM') > 0).
EXE .
In Excel, you could take a similar approach. Assuming your text verbatims are in column A:
=IF(OR(ISNUMBER(SEARCH("DVT",A1)),ISNUMBER(SEARCH("PULMONARY EMBOLISM",A1)),ISNUMBER(SEARCH("THROMBOEMBOLISM",A1))),1,0)
Alternatively, if you're comfortable using SUMPRODUCT(), the formula gets a bit shorter. Assuming you list your "strings to search for" in cells C2:C5:
=SUMPRODUCT(--ISNUMBER(SEARCH(C2:C5,A1)))>0
Note that all of the above options are case-insensitive.

Separating values that are combined in one string

I would like to solve this either in Excel or in SPSS:
I have categorical data (each number representing a medical diagnosis) that are combined into single cells. In other words, a row (patient) has multiple diagnoses. However, I would like to know the frequencies of each diagnosis. What is the best way to go about this? (See picture for reference)
For SPSS:
First just creating some sample data to demonstrate on:
data list free/e_cerv_dis_state (a20).
begin data
"{1/2/3/6}" "{1/2/4}" "{2/4/5}" "{1/5/6}" "{4}" "{4/5/6}" "{1/2/3/4/5/6}"
end data.
Now the following code will create a separate variable for each possible diagnosis, and will put a 1 in it if the diagnosis exists in the original variable.
do repeat vr=diag1 to diag9/vl=1 to 9.
compute vr=char.index(e_cerv_dis_state, string(vl, f1) ) > 0.
end repeat.
freq diag1 to diag6.
Note this will only work for up to 9 diagnoses. If you have more than that the solution will have to be adapted to multiple digits.
Assuming that the number of columns is fairly regular, I would suggest using text to columns, and then using COUNTIF on the cells if they are the value wanted. However there is a more robust and reproducible solution that would involve using SQL. If you download the free version of SQL Express here: https://www.microsoft.com/en-gb/sql-server/sql-server-downloads
Then you can import your table of data, here's how to do that: How to import an Excel file into SQL Server?
Then you could use the more friendly SQL database to get the answers you want. For example you can use a select statement that would say:
SELECT count(e_cerv_dis_state)
WHERE e_cerv_dis_state = '6'
It would also be possible to use a CASE WHEN statement to add-in the names of the diagnoses.

Resources