mxArray to double?
34 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using simevents and using importdata to bring variable from .mat file to simevents. I want to use this variable in if statement and possibly change the value as well. However, I am getting this error:
Expected either a logical, char, int, fi, single, or double. Found an mxArray. MxArrays are returned from calls to the MATLAB interpreter and are not supported inside expressions. They may only be used on the right-hand side of assignments and as arguments to extrinsic functions.
Is there a way to fix this? mxArray to double? I have an example below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1081205/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1081210/image.png)
choice.mat has one variable.
I have tried declaring the variable count as doule and called importdata, but I'm still getting the same error.
2 Kommentare
Antworten (1)
Abderrahim. B
am 29 Jul. 2022
Hi!
I' m not sure how did define variable count as double!
Try to preinitialize the variable count before calling the function.
count = zeros(size(count))
If you don't know the size of your variable then use zeros .
Hope this helps
2 Kommentare
Abderrahim. B
am 1 Aug. 2022
Glad it worked.
- If you found my answer helpful and want others with same issue to refer to it, accept it!
Siehe auch
Kategorien
Mehr zu Discrete-Event Simulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!