Respondida
how can I change a sequence so that the values of the sequence are zero if the the result division by 2 is not an integer in MATLAB?
x=[0 1 2 3 4]; y=x; index=mod(x,2)~=0; y(index)=0

más de 2 años hace | 0

| aceptada

Respondida
How to get the exact file pathname for a linked library
save_system() has options to skip prompt, ignore warning and force save. If there are multiple files with the same name as the ...

más de 2 años hace | 0

Respondida
Make Timer in Simulink
It might be easier to implement it through Simulinnk block diagram, similar to this one. https://www.mathworks.com/matlabcentra...

más de 2 años hace | 1

| aceptada

Respondida
convert 16bit char to 4 byte hex values
c=char(["1000100010001000"; "0000000000000010"; "1111111111111111"]) d=dec2hex(bin2dec(c))

más de 2 años hace | 0

Respondida
Delete every nth element in array and increasing 1 NaN value per new row
nRow=15; nCol=10; Array=repmat(1:nCol,nRow,1); for k=1:nRow index=mod((1:nCol),k+1)~=1; Array(k,index)=nan; end A...

más de 2 años hace | 0

Respondida
How can you populate a cell array horizontally to get correct data in columns?
reshape(datare,28,[]) and then transpose() data=num2cell(1:80); datare = reshape(data,1,[]); web = reshape(datare,8,[]); tra...

más de 2 años hace | 1

| aceptada

Respondida
block first row of a cell
value = {'Value';'8126';'5354';'1406';'4265'}; name = {'Name';'B';'A';'N';'R'}; union = [name,value]; B = sortrows(union(2:en...

más de 2 años hace | 0

Respondida
One-time data import into Simulink
What you need to do are: Load the 10001x5 matrix into MATLAB base workspace. This just needs to be done once and can be done th...

más de 2 años hace | 0

| aceptada

Respondida
How I write an exist inside a for loop that will continue if the variable does not exist?
exist('wrist', 'var'), not exist(wrist, 'var') exist('wrist', 'var'), not exist('wrist{k}', 'var') I suggest using try-catch ...

más de 2 años hace | 0

| aceptada

Respondida
N-D Look up Tables
You have a 10000x8 table. The first seven columns (10000x7) data is all the possible combinations of the seven input variables. ...

más de 2 años hace | 0

| aceptada

Respondida
Is there a path in the string?
You can utilize the exist() function. Assume you are at the c:\root folder, and there is a \report sub-folder exist('\report',...

más de 2 años hace | 1

Respondida
Stream data from function to workspace in real time
Use the MATLAB Function block.

más de 2 años hace | 0

Respondida
Simulink: Class instance as output of a MATLAB function block
If involving object and class, use the MATLAB System block, although, you can't output an "object". You can utilize the methods ...

más de 2 años hace | 0

Respondida
keep getting an error message saying might be missing a closing bracket, causing invalid syntax at y, but the bracket is there. (line 34)
You can paste the text, instead of attaching a snapshot picture. I believe there is a mistake in defining the odeFun. There is ...

casi 3 años hace | 0

Respondida
Simulink Switch doesn't propagate rate transition
Not sure what you exactly mean, but a Signal Specification block can specify any rate you want.

casi 3 años hace | 0

Respondida
Can I link optimization code with Simulink file?
In the most common case, you run the code above, all the variables will be created in the base workspace. If your Simulink model...

casi 3 años hace | 0

Respondida
How to load the simulink variables and parameters from model workspace to the base workspace
Don't copy. Use the Model block (model reference) to reference models in another model. Do it manually. Open all the models. Op...

casi 3 años hace | 1

Respondida
How to Hold the sensor values for 10s and update the output value (boolean) using simulink
Use a Unit Delay block to store the previous value. I assume that is what you will use to compare "If the value from sensor is s...

casi 3 años hace | 0

Respondida
find_system() for custom library
The blks = find_system() will return 4 block handles. The first one is "sys" itself and the next three are the three customized ...

casi 3 años hace | 0

Respondida
How do I avoid hardcoding output size when using simulink coder.extrinsic?
I suspect that the "parameter" in your code is not really a parameter-by-definition by the MATLAB Function block. It appears as ...

casi 3 años hace | 0

| aceptada

Respondida
why is my code not outputting to an excel file? Can someone fix this? I get Warning: Unable to write to Excel format, attempting to write file to CSV format.
In terms of xlswrite(), your code is fine. I've tried it and it creates the file. You might want to change range='A2:F37'. Try ...

casi 3 años hace | 0

| aceptada

Respondida
Merging cells problem with actxserver
The merge of D1:E1 was impacted by the merge of B1:C1? Try the reverse order, F1:G1, then D1:E1, then B1:C1. Also, variable "e...

casi 3 años hace | 0

| aceptada

Respondida
Is it possible to extract data points from what is displayed on the Array Plot block in Simulink into the base MATLAB workspace?
The way you save the data points to the MATLAB base workspace is correct. The Array Plot shows the frequency on x axle from 0 ...

casi 3 años hace | 0

Respondida
Naming signal in simulink based on workspace variable value.
It can't be done like a numerical parameter, where you can type in e.g. pi, instead of 3.1415926535 But it can be done through ...

casi 3 años hace | 0

Respondida
I face this error every time.
The referred mdlStart.m file must have been accidently modified or over-written. The original file is a M-file function. The mes...

casi 3 años hace | 0

Respondida
How to change the width of the command window?
Apparently, the width won't be big enough even if you could adjust it. Try this: a=1:100; open a

casi 3 años hace | 0

| aceptada

Respondida
Simulink Matlab function block output is inferred as a variable-size matrix, but its size is specified as inherited or fixed
There are issues with the code. The size of "inputStream" is going to grow indifinitely. I suggest using a Buffer block to repl...

casi 3 años hace | 0

| aceptada

Respondida
Changing the font size in the mask gives warning
You may not realize, text() used in Simulink Mask doesnot have full functionality as in MATLAB. See this note in the doc. While...

casi 3 años hace | 0

Respondida
How to select specific data rows from neighboring column
index=and(T(:,1)>=21, T(:,1)<=30); x=T(index,4); y=T(index,3); z=T(index,2);

casi 3 años hace | 1

| aceptada

Respondida
loss of data/missing elements in array after a for loop
If you don't pre-allocate idx_matrix_bool_mat_filt, this could happen. Do idx_matrix_bool_mat_filt=TD_32_colon before the loop. ...

casi 3 años hace | 1

| aceptada

Cargar más