Answered

X, Y label disappeared in app designer after exporting?

Hi, I guess you should check which callback function is associated with your button, maybe this button plots the figure again w...

X, Y label disappeared in app designer after exporting?

Hi, I guess you should check which callback function is associated with your button, maybe this button plots the figure again w...

1 year ago | 0

Answered

Convert for loop Matlab in python

The equivalent of for i = start:step:finish % do something end is for i in range(start, finish+1,step): #do some...

Convert for loop Matlab in python

The equivalent of for i = start:step:finish % do something end is for i in range(start, finish+1,step): #do some...

1 year ago | 0

Answered

How to convert a string into a variable name and assign it a cell of data?

You can use the function eval, although it is not recommanded. For example doing something like: eval([strVarName '=' strVarVa...

How to convert a string into a variable name and assign it a cell of data?

You can use the function eval, although it is not recommanded. For example doing something like: eval([strVarName '=' strVarVa...

1 year ago | 0

| accepted

Answered

How to convert the simulink model to s-function

As said on the error, you must install the compilers on the given link. Then you will be able to generate your S function.

How to convert the simulink model to s-function

As said on the error, you must install the compilers on the given link. Then you will be able to generate your S function.

1 year ago | 0

| accepted

Answered

Copy an image (to be selected with a parameter) from one folder to another

filePattern = fullfile(origin_folder, ['name of figure' num2str(k) '.jpg']);

Copy an image (to be selected with a parameter) from one folder to another

filePattern = fullfile(origin_folder, ['name of figure' num2str(k) '.jpg']);

1 year ago | 0

| accepted

Answered

How to generate distincted distanced coordinates?

x = [0:50:1000]; y = [0:50:1000]; [xGrid,yGrid] = meshgrid(x,y);

How to generate distincted distanced coordinates?

x = [0:50:1000]; y = [0:50:1000]; [xGrid,yGrid] = meshgrid(x,y);

1 year ago | 2

| accepted

Answered

How to find the maximum element by length without a loop?

arrayStr = [a,b]; [~,i] = max(strlength(arrayStr)); maxStr = arrayStr(i); Careful, that works only if a and b are strings, it...

How to find the maximum element by length without a loop?

arrayStr = [a,b]; [~,i] = max(strlength(arrayStr)); maxStr = arrayStr(i); Careful, that works only if a and b are strings, it...

1 year ago | 1

| accepted

Answered

Plotting time in hours

You have one line per hour so you can use directly the line index as your time series and plot the associated variable according...

Plotting time in hours

You have one line per hour so you can use directly the line index as your time series and plot the associated variable according...

1 year ago | 0

Answered

How to find number of input and output ports of an unknown simulink model ?

Hi, You need to use the function get_param with 'Ports' as a parameter, for each subsystem of your model. The first and second...

How to find number of input and output ports of an unknown simulink model ?

Hi, You need to use the function get_param with 'Ports' as a parameter, for each subsystem of your model. The first and second...

1 year ago | 0

Answered

How to load data into a function

Hi, If data is a variable, you must include it as a input of your function function [z] = hello(x,y,data) load(data) %Rest o...

How to load data into a function

Hi, If data is a variable, you must include it as a input of your function function [z] = hello(x,y,data) load(data) %Rest o...

1 year ago | 0

Answered

How can I make my function plot lines to make a rectangle?

Hi, Your function just plots one point. You need to plot all the points of your rectangle, and closing it by returning at the f...

How can I make my function plot lines to make a rectangle?

Hi, Your function just plots one point. You need to plot all the points of your rectangle, and closing it by returning at the f...

1 year ago | 1

| accepted

Answered

move txt file from one folder to another

Hi, There is an error in your code, you've added quotes around your variable name. This should work. A = 300; writematrix(A, ...

move txt file from one folder to another

Hi, There is an error in your code, you've added quotes around your variable name. This should work. A = 300; writematrix(A, ...

1 year ago | 0

| accepted

Answered

How can I load different simulink model blocks into new simulink model using Matlab scripts ?

Hi, Check add_block: add_block

How can I load different simulink model blocks into new simulink model using Matlab scripts ?

Hi, Check add_block: add_block

1 year ago | 0

| accepted

Answered

How to create personalized colormap that starts from a specified value

Hi If Z is the map you plot, you can replace all the negative values by 0 like that : Z = [0 1 8; -1 5 10;-6 -3 14] Z_nega...

How to create personalized colormap that starts from a specified value

Hi If Z is the map you plot, you can replace all the negative values by 0 like that : Z = [0 1 8; -1 5 10;-6 -3 14] Z_nega...

1 year ago | 0

| accepted

Answered

Why a field is replaced by next field when corresponding function is being called within a loop?

Hi, You're using the same [SL_CI,DL_CI] to store both fields, so the last one override the first one. You should have storing...

Why a field is replaced by next field when corresponding function is being called within a loop?

Hi, You're using the same [SL_CI,DL_CI] to store both fields, so the last one override the first one. You should have storing...

1 year ago | 0

Answered

Getting just the time in Date-time cell

Hi for i = 1:length(txt(:,1)) if ~isempty() txtSplit = strsplit(txt{i,1},' '); txt{i,2} = txtSplit{2}; end The value ...

Getting just the time in Date-time cell

Hi for i = 1:length(txt(:,1)) if ~isempty() txtSplit = strsplit(txt{i,1},' '); txt{i,2} = txtSplit{2}; end The value ...

1 year ago | 0

| accepted

Answered

Repeatedly call a function in App Designer while working with the App

Hi Have a look a these: https://uk.mathworks.com/help/matlab/matlab_prog/use-the-background-to-make-your-apps-more-responsive....

Repeatedly call a function in App Designer while working with the App

Hi Have a look a these: https://uk.mathworks.com/help/matlab/matlab_prog/use-the-background-to-make-your-apps-more-responsive....

1 year ago | 0

Answered

find Maximum values in intervals of time(each 2000 values)

Hi, I would do something like that for i = 1:(length(u)-1)/2000 maxArray(i) = max(u((i-1)*2000+1:i*2000)); end You'll ...

find Maximum values in intervals of time(each 2000 values)

Hi, I would do something like that for i = 1:(length(u)-1)/2000 maxArray(i) = max(u((i-1)*2000+1:i*2000)); end You'll ...

1 year ago | 0

Answered

Predict power consumption using linear regression

Hi, You can use the function polyfit with x being the time and y being the power consumption, you will have to choose n to fit ...

Predict power consumption using linear regression

Hi, You can use the function polyfit with x being the time and y being the power consumption, you will have to choose n to fit ...

1 year ago | 0

Answered

How to multiply two cell array

Hi, C = {}; A={1,2,3}; B={'a','b','c'}; for i = 1:length(A) for j = 1:length(B) C{end+1} = {A{i},B{j}}; e...

How to multiply two cell array

Hi, C = {}; A={1,2,3}; B={'a','b','c'}; for i = 1:length(A) for j = 1:length(B) C{end+1} = {A{i},B{j}}; e...

1 year ago | 0

| accepted

Answered

how to debug the non-working of real() function?

Hi, I guess sinr_los1 is your matrix ? Could you share the inputs and the outputs ? Because both solutions should work M = ...

how to debug the non-working of real() function?

Hi, I guess sinr_los1 is your matrix ? Could you share the inputs and the outputs ? Because both solutions should work M = ...

1 year ago | 0

Question

fopen always open the file even when it is already open

Hi, fopen is supposed to return -1 when it can't open the file. So I thought when I had the file open already it would return -...

1 year ago | 1 answer | 0

Answered

Why two variables loading the same .mat file are not equal ?

I finally used isequaln to get the result I wanted, thank you all.

Why two variables loading the same .mat file are not equal ?

I finally used isequaln to get the result I wanted, thank you all.

2 years ago | 0

Question

Why two variables loading the same .mat file are not equal ?

Hi, I found something weird today and couldn't find an explanation on the forum. When I load the same matlab file twice, and t...

2 years ago | 3 answers | 0