Answered

How can I select a .m file through browser push button option in GUI and add/save that file in my current Matlab working directory ? Any guidance is appreciated.TIA

[file,path] = uigetfile('*.m','Choose file to save'); copyfile([path file], pwd)

How can I select a .m file through browser push button option in GUI and add/save that file in my current Matlab working directory ? Any guidance is appreciated.TIA

[file,path] = uigetfile('*.m','Choose file to save'); copyfile([path file], pwd)

ungefär 9 år ago | 0

| accepted

Answered

Connect two blocks in a subsytem

Hi Nedra, I couldn't load the image you have attached. You could give this a try: add_line('Mtest/Subsystem', 'Logical O...

Connect two blocks in a subsytem

Hi Nedra, I couldn't load the image you have attached. You could give this a try: add_line('Mtest/Subsystem', 'Logical O...

ungefär 9 år ago | 0

Answered

Need help to create matlab script to convert currency

Here is function for it : you can easily convert to a script if you want. function currencyTable = convertCurrency(toUsd, t...

Need help to create matlab script to convert currency

Here is function for it : you can easily convert to a script if you want. function currencyTable = convertCurrency(toUsd, t...

ungefär 9 år ago | 0

Answered

how to find differences in two simulink configuration settings using m-script

You can return a variable if you run the function 'active_config' after you have saved it as mentioned in the question. >> ...

how to find differences in two simulink configuration settings using m-script

You can return a variable if you run the function 'active_config' after you have saved it as mentioned in the question. >> ...

ungefär 9 år ago | 0

| accepted

Answered

Modifying discrete filter block simulink

Hi Adam, If you're trying to modify the sample time from the command prompt, this api might be helpful: >> load_system('...

Modifying discrete filter block simulink

Hi Adam, If you're trying to modify the sample time from the command prompt, this api might be helpful: >> load_system('...

ungefär 9 år ago | 0

| accepted

Answered

List of structures as input to getfield()?

First Argument of 'getfield' should be a struct. `myStructList(i).name` probably refers to a char type variable. If myStruct...

List of structures as input to getfield()?

First Argument of 'getfield' should be a struct. `myStructList(i).name` probably refers to a char type variable. If myStruct...

ungefär 9 år ago | 0

Answered

For-loop in Matlab

You don't even need a for loop c = 1:10; x = sind(c);

For-loop in Matlab

You don't even need a for loop c = 1:10; x = sind(c);

ungefär 9 år ago | 1

Answered

double for loop with changing start point at second loop. need help, wrong output.

n = 10; result = zeros(n,n-1); for N1=1:1:(n-1) for N2=(N1+1):1:n result(N2,N1) = N2+N1; end ...

double for loop with changing start point at second loop. need help, wrong output.

n = 10; result = zeros(n,n-1); for N1=1:1:(n-1) for N2=(N1+1):1:n result(N2,N1) = N2+N1; end ...

ungefär 9 år ago | 0

| accepted

Answered

How can I find duplicate sub systems in model using m-script

This below code should work for reasonably simple subsystems. I haven't tried for any complex ones - like with triggered input. ...

How can I find duplicate sub systems in model using m-script

This below code should work for reasonably simple subsystems. I haven't tried for any complex ones - like with triggered input. ...

ungefär 9 år ago | 0

| accepted

Answered

M script: How to find which block is connected to which block?

>> load_system(myModel); >> allBlks = find_system(myModel, 'Type', 'block') Now this will give you all the blocks in the...

M script: How to find which block is connected to which block?

>> load_system(myModel); >> allBlks = find_system(myModel, 'Type', 'block') Now this will give you all the blocks in the...

ungefär 9 år ago | 3

| accepted

Answered

find a row with a column value don't remove duplicated cells

for j=1, it is trying to access data1{0,1} but matlab indexing starts from 1.

find a row with a column value don't remove duplicated cells

for j=1, it is trying to access data1{0,1} but matlab indexing starts from 1.

ungefär 9 år ago | 0

| accepted

Answered

Creating a surface plot using Simulink?

Hi Vokler, if you already have designed the simulink model, you could simply use load_system and sim to get the output.

Creating a surface plot using Simulink?

Hi Vokler, if you already have designed the simulink model, you could simply use load_system and sim to get the output.

ungefär 9 år ago | 0

Answered

Hello, i need the values in simulink..

From what I understand, you are trying to save the output of the simulation in an excel file, in place of viewing in the scope. ...

Hello, i need the values in simulink..

From what I understand, you are trying to save the output of the simulation in an excel file, in place of viewing in the scope. ...

ungefär 9 år ago | 0

Answered

About fixing a script

You have an error in 'mat2cell' function call in line 45 of your script. Please see the documentation to get more information on...

About fixing a script

You have an error in 'mat2cell' function call in line 45 of your script. Please see the documentation to get more information on...

ungefär 9 år ago | 0

| accepted

Answered

creating a new vector relative to the matrix

% A = your 10x6 original matrix; uRows = unique(A, 'rows'); result = zeros(6,1); for i=1:size(uRows, 1) ...

creating a new vector relative to the matrix

% A = your 10x6 original matrix; uRows = unique(A, 'rows'); result = zeros(6,1); for i=1:size(uRows, 1) ...

ungefär 9 år ago | 0

| accepted

Answered

I need a plot with x axis from 1 to 6 and I used axis([1 6 0 10]). This gives me decimals on the axis like 1, 1.5, 2,2.5 and so on. I need only 1, 2, 3 and so on instead of the decimals .How can I get rid of the decimals on the x axis?

ax = gca; % Get the axis of your figure ax.XTickLabel = 1:6;

I need a plot with x axis from 1 to 6 and I used axis([1 6 0 10]). This gives me decimals on the axis like 1, 1.5, 2,2.5 and so on. I need only 1, 2, 3 and so on instead of the decimals .How can I get rid of the decimals on the x axis?

ax = gca; % Get the axis of your figure ax.XTickLabel = 1:6;

ungefär 9 år ago | 0

| accepted

Answered

Singleton for database connection: availability problem

I became intrigued and scribbled something on my own. I guess you already know this stuff: classdef (Sealed) MyDBConnection...

Singleton for database connection: availability problem

I became intrigued and scribbled something on my own. I guess you already know this stuff: classdef (Sealed) MyDBConnection...

ungefär 9 år ago | 0

Answered

replace the string a cell array with empty cell

You may directly use the strrep function a = strrep(a, 'def', '');

replace the string a cell array with empty cell

You may directly use the strrep function a = strrep(a, 'def', '');

ungefär 9 år ago | 0

| accepted

Answered

matrix with elements sum of elements of old matrix

This would work, but maybe there's a better solution. a = [3 4 2 5]; a_new = a(1:end-1); a_new(end) = a_new(end) + a(...

matrix with elements sum of elements of old matrix

This would work, but maybe there's a better solution. a = [3 4 2 5]; a_new = a(1:end-1); a_new(end) = a_new(end) + a(...

ungefär 9 år ago | 1

Answered

pls i need ful information and steps on how to use matlab to plot sin wave curve

You could find an example in the matlab documentation for plot function. >> doc plot

pls i need ful information and steps on how to use matlab to plot sin wave curve

You could find an example in the matlab documentation for plot function. >> doc plot

ungefär 9 år ago | 0

Answered

computing first 50 terms of sequence

Keeping your code intact for most of the part, this is a quick fix x = zeros(2,50); x(:,1) = [1;0]; A = [1.52 -.7; .5...

computing first 50 terms of sequence

Keeping your code intact for most of the part, this is a quick fix x = zeros(2,50); x(:,1) = [1;0]; A = [1.52 -.7; .5...

ungefär 9 år ago | 0

| accepted

Answered

picking data from excel

matlab provides an extensive documentation on xlsread. Please try and see if this helps doc xlsread

picking data from excel

matlab provides an extensive documentation on xlsread. Please try and see if this helps doc xlsread

ungefär 9 år ago | 0

| accepted

Answered

Contain outputs of function in one table(?)

1. If your output variables all have equal number of rows, you indeed can use a 'table' datatype. doc table 2. Otherwise...

Contain outputs of function in one table(?)

1. If your output variables all have equal number of rows, you indeed can use a 'table' datatype. doc table 2. Otherwise...

ungefär 9 år ago | 1

| accepted

Answered

How to replace data in a matrix by comparing from another matrix?

Assuming, the 'a' matrix has unique values in the first column for bRow= 1:size(b, 1) aRow = find(a(:,1)==b(bRow,1),...

How to replace data in a matrix by comparing from another matrix?

Assuming, the 'a' matrix has unique values in the first column for bRow= 1:size(b, 1) aRow = find(a(:,1)==b(bRow,1),...

ungefär 9 år ago | 1

Answered

How do I loop through incrementally changing values

You could utilize the colon and element-wise operators, instead of looping. For example: alpha = 1:0.5:20; a = 0.1 + ...

How do I loop through incrementally changing values

You could utilize the colon and element-wise operators, instead of looping. For example: alpha = 1:0.5:20; a = 0.1 + ...

ungefär 9 år ago | 0

Answered

How do i create two multi-dimensional arrays: a 10 x 10 x 10 numerical array (3-D) anda 5 x 5 x 5 x 5 numerical array (4-D) where each value in each array corresponds to the multiplication of indices?

This could be another approach: A = ones(10, 10, 10); for i=1:10 A(i,:,:) = A(i,:,:)*i; A(:,i,:) = A(:,i,:)*i;...

How do i create two multi-dimensional arrays: a 10 x 10 x 10 numerical array (3-D) anda 5 x 5 x 5 x 5 numerical array (4-D) where each value in each array corresponds to the multiplication of indices?

This could be another approach: A = ones(10, 10, 10); for i=1:10 A(i,:,:) = A(i,:,:)*i; A(:,i,:) = A(:,i,:)*i;...

ungefär 9 år ago | 2

| accepted

Answered

Color maps and for loops

I guess, this is what you're looking for: myMap = zeros(4,3); for i=1:4 myMap(i,1) = i/4; end firstCo...

Color maps and for loops

I guess, this is what you're looking for: myMap = zeros(4,3); for i=1:4 myMap(i,1) = i/4; end firstCo...

ungefär 9 år ago | 0

| accepted

Answered

add the particular column in the for loop

Are you looking for something like this? dataMatrix = [1 2 3; 4 5 6; 7 8 9]; outPut = zeros(size(dataMatrix,2),1); ...

add the particular column in the for loop

Are you looking for something like this? dataMatrix = [1 2 3; 4 5 6; 7 8 9]; outPut = zeros(size(dataMatrix,2),1); ...

ungefär 9 år ago | 0

Answered

While loop for a menu

In my opinion, the proper way of doing this would be - using call-back functions. Please have a look if this documentation helps...

While loop for a menu

In my opinion, the proper way of doing this would be - using call-back functions. Please have a look if this documentation helps...

ungefär 9 år ago | 0

| accepted